News for hackers. Stuff that matters.
Re:Parsing R code: Freedom of expression is not always a goo... by waffleiron on Tuesday June 14, 2022 @09:29AM (#31739142)
As someone who actually likes R I think this makes sense. Line 5 is checking for equality, whereas in R as.* functions actually convert types or structures. The documentation on as.logical is also pretty clear on what would happen.

https://www.rdocumentation.org/packages/raster/versions/3.5-...

> Change values of a Raster* object to logical or integer values. With as.logical, zero becomes FALSE, all other values become TRUE. With as.integer values are truncated.

Re:Parsing R code: Freedom of expression is not always a goo... by jghn on Tuesday June 14, 2022 @10:47AM (#31740309)
Yeah. There's a difference between "This language isn't being internally consistent" and "Due to my experience using language X, I find this confusing". As you say, this is well documented behavior, albeit perhaps unexpected to a novice R user.