[R] conversion of a list element to a vector

Philippe Hupé Philippe.Hupe at curie.fr
Tue May 20 13:34:04 CEST 2003


I would like to extract unique elements of a variable which belongs to a 

liste <- list(V1=c(1,2,3,5,2), V2=c(1,2,3,4,5))
var <- "V1"
uni <- unique(liste[var]) #does not work

I know that liste[var]$V1 works but for my problem, the label variable 
"V1" is only know through the var variable.

I can I do

Thanks in advance.

More information about the R-help mailing list