Re: [R] variable row names

From: COMTE Guillaume <g.comte_at_alliance-ir.net>
Date: Wed 17 May 2006 - 01:44:36 EST


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@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@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@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
>
>
>
>



R-help@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 Received on Wed May 17 01:51:20 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 17 May 2006 - 04:10:09 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.