Hello,

Try

x<-data.frame(A=1:5,B=6:10,C=11:15,D=16:20,E=21:26)
titles<-c("A","B","C","E")

y <- "C"
x[ , y]

Hope this helps,

Rui Barradas


--
View this message in context: 
http://r.789695.n4.nabble.com/Calling-a-column-from-a-matrix-using-a-variable-tp4457466p4457509.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to