# use the mtcars data frame as your starting list.  save it to x
x <- as.list( mtcars )

# just print one column, by hand.
x$wt

# ..dynamically choose the column you want
colname <- 'wt'

# this breaks
get( paste( 'x$' , colname , sep = "" ) )

# this works, but doesn't do what you want, since it's not dynamic
get( 'x' )$wt

# why not access the list dynamically without paste() or get()  ?  ;)
x[ colname ]

        [[alternative HTML version deleted]]

______________________________________________
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