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

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -