[R] simple question about variables....

Stéphane Cruveiller scruveil at genoscope.cns.fr
Thu Jul 13 10:19:16 CEST 2006


Thx for the tip....


Stéphane.

Jacques VESLOT a écrit :
> see ?"$"
> 'x$name' is equivalent to 'x[["name"]]'
>
> so you need use :
> eval(parse(text = paste("OBJ$", varname)))
>
> -------------------------------------------------------------------
> Jacques VESLOT
>
> CNRS UMR 8090
> I.B.L (2ème étage)
> 1 rue du Professeur Calmette
> B.P. 245
> 59019 Lille Cedex
>
> Tel : 33 (0)3.20.87.10.44
> Fax : 33 (0)3.20.87.10.31
>
> http://www-good.ibl.fr
> -------------------------------------------------------------------
>
>
> Stéphane Cruveiller a écrit :
>> Dear R users,
>>
>> I have a simple question on variable manipulation.
>> Imagine I have an object "OBJ" that has "toto" as one of its variables.
>> I would like to understand why if I do
>>
>>  > varname <- "toto"
>>
>>  >OBJ$varname                             returns no results
>>
>> whereas
>>
>>  > OBJ[varname]                            returns the column 
>> entitled "toto"
>>
>>
>> Thanks for your help.
>>
>> Stéphane.
>>
>> ______________________________________________
>> R-help at stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide! 
>> http://www.R-project.org/posting-guide.html
>>



More information about the R-help mailing list