[R] OK - I got the data - now what? :-)

David Winsemius dwinsemius at comcast.net
Sun Jul 5 17:18:34 CEST 2009


On Jul 5, 2009, at 10:50 AM, Uwe Ligges wrote:

>
>
> David Winsemius wrote:
>>
>> So if your values are calculated from other values then consider  
>> using all.equal()
>> And repeated applications of the testing criteria process are  
>> effective:
>> test[3,][which(names(test)=="C1"):(which(test[3,] == 0.0)-1)]
>>    C1   C2   C3
>> 3 0.52 0.66 0.51
>> (and a warning that does not seem accurate to me.)
>> In which(names(test) == "C1"):(which(test[3, ] == 0) - 1) :
>>  numerical expression has 3 elements: only the first used
>
>
> David,
>
> # which(test[3,] == 0.0)
> [1] 6 7 8
>
> and in a:b a and b must be length 1 vectors (scalars) otherwise just  
> the first element (in this case 6) is used.
>
> That leads us to the conclusion that writing the line above is not  
> really the cleanest way or you intended something different ....

Thanks, Uwe. I see my confusion. I did want 6 to be used  and it looks  
as though I would not be getting in truouble this way, but a cleaner  
method would be to access only the first element of which(test[3, ] ==  
0):

test[3,][ which(names(test) == "C1") : (which(test[3,] == 0.0)[1]-1) ]

>
> David

>> Seems to me that all of the element were used. I cannot explain  
>> that warning but am pretty sure it can be ignored.
>>

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list