[R] variable row names
COMTE Guillaume
g.comte at alliance-ir.net
Tue May 16 17:44:36 CEST 2006
Thks for your answer,
I wish to access colnames by using vars like in my example nom="toto" , if i type toto in R it will display the column named toto with the values that the column keep, i wish the same by typing nom, but in my case it shows the content of the var nom not the values of the column named toto, but "toto".
I can't be more accurate because i'm unable to formulate it an other way.
another example:
I've got a set of colnames :
> nomalarme1
[1] "AirFlowFailure" "AirSensorFailure" "GasLeek"
[4] "SuddenPressureDrop" "InletPressureToLow" "PressureRiseFailure"
[7] "HoseLeakTestFailure" "o50DCVoltageToLow"
All of these names identify colnames (like AirFlowFailure).
My problem is if i do
For (i in 1:length(nomalarme1))
{
nomalarme1[i]
}
It will display the names of the columns not the datas, is there is something that can tell R to show data's that have for colname nomalarme[i], and not just the colname.
Thks for your answer, i've looked into S-Poetry and it seems that it isn't explained there, but my "poor" english maybe have missed it...
COMTE Guillaume
-----Message d'origine-----
De : Patrick Burns [mailto:pburns at pburns.seanet.com]
Envoyé : mardi 16 mai 2006 17:12
À : COMTE Guillaume
Objet : Re: [R] variable row names
I don't understand your question, but perhaps the
subscripting section of chapter 1 of S Poetry can
help you.
Patrick Burns
patrick at burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")
COMTE Guillaume wrote:
>Hy all,
>
>
>
>I wish to use a variable as rownames for a set of datas.
>
>
>
>By example :
>
>
>
>
>
>
>
>>nom<-"toto"
>>
>>
>
>
>
>>prenom<-"tutu"
>>
>>
>
>
>
>>res<-c(1,2)
>>
>>
>
>
>
>>res<-t(res)
>>
>>
>
>
>
>>res
>>
>>
>
> [,1] [,2]
>
>[1,] 1 2
>
>
>
>>colnames(res)<-c(nom,prenom)
>>
>>
>
>
>
>>res
>>
>>
>
> toto tutu
>
>[1,] 1 2
>
>
>
>>nom
>>
>>
>
>[1] "toto"
>
>
>
>
>
>
>I wish to call the rowname by the variable name, in this case it would
>be < nom > or < prenom > , but if i do that it gives me the name of the
>row not the values of it.
>
>
>
>Is this possible or not?
>
>
>
>Thks all.
>
>
>
>COMTE Guillaume
>
>
>
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>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