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 -

how to prompt save As Box in Excel Interlop c# MVC 4 -

xslt 1.0 - How to access or retrieve mets content of an item from another item? -