Wacek Kusnierczyk wrote:
> Prof Brian Ripley wrote:
>   
>> On Tue, 6 Jan 2009, Petr PIKAL wrote:
>>
>> [...]
>>
>>     
>>> Logical vectors can be treated like numeric with TRUE=1 and FALSE=0,
>>>       
>> More accurately, 'like integer' ('numeric' often means 'double').
>>
>>     
>
> why would this be more accurate?
>
> is(TRUE+0)
> # numeric, not integer
>
> is.integer(TRUE+0)
> # FALSE
>
>   
ah, that was about literals again:

is(TRUE+0L)
# integer, not numeric

is.integer(TRUE+0L)
# TRUE

anyway,

is.integer(TRUE)
# FALSE

so how logical vectors will be treated depends on the context, though
integer is (or it seems so) closer in the type hierarchy than double.

vQ

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to