Re:Parsing R code: Freedom of expression is not always a goo...
by kgwgk on Tuesday June 14, 2022 @11:52AM
(#31741228)
as.logical(2) being TRUE is perplexing only if you interpreted
2 == TRUE
as
as.logical(2)==TRUE
rather than as
2==as.integer(TRUE)
[Edit: "If the two arguments are atomic vectors of different types, one is coerced to the type of the other, the (decreasing) order of precedence being character, complex, numeric, integer, logical and raw."]
2 == TRUE
as
as.logical(2)==TRUE
rather than as
2==as.integer(TRUE)
[Edit: "If the two arguments are atomic vectors of different types, one is coerced to the type of the other, the (decreasing) order of precedence being character, complex, numeric, integer, logical and raw."]