[R] Fatal Error R

David Winsemius dwinsemius at comcast.net
Wed Nov 17 06:34:14 CET 2010


On Nov 16, 2010, at 7:02 PM, José Fernando Zea Castro wrote:

> Hello.
>
> First, I'm thankful about your wonderful project.
>
> However, I have serious worries about the reliability of R. I found
> the next bug which I consider important because in my job everytime We
> work with datanames like next. Please see below:
>
>
> b=data.frame(matrix(1:9,ncol=3))
> names(b)=c("q99","r88","s77")
>
>> b
>  q99 r88 s77
> 1   1   4   7
> 2   2   5   8
> 3   3   6   9
>> b$q9
> [1] 1 2 3

Not only that but:
 > b$q
[1] 1 2 3


>
>
> Please note that the variable q9 does not exist in the dataframe, but
> you can see  that R
> show q9 (as q99).

Read the section in ?Extract on "Character indices". The $ operator is  
weird in other ways as well. Better to use [[ ]] therefore.


>
> Thank in advanced
>
>
> Cordially
> José Fernando Zea Castro
> Statistician Universidad Nacional Colombiana


-- 
David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list