boolean - What does * means in R? -
for instance:
> true * 0.5 0.5 > false * 0.5 0
i don't know if secret here * character or way r encodes logical statements, can't understand why results.
r has loose type system , rather freely coercion, when sensible. when coerced numeric *
, logical values become 0 (false) , 1 (true), expression gets evaluated usual mathematical convention of values times 0 equal 0, , values times 1 equal value. 1 exception rule in numeric domain inf * 0
returns nan
. character values have no "destination"-type when composed "*", "1"*true
throws error.
Comments
Post a Comment