Skip to content
Prev 200349 / 398503 Next

How to name a tag in a list or a data.frame from a string?

On 15/11/2009 8:15 PM, Peng Yu wrote:
The most straightforward way is

x <- list(1:3)
names(x) <- string

y <- data.frame(dummy=1:3)
names(y) <- string

You can also build expressions and parse and evaluate them, but the 
lines above are the easiest way.

Duncan Murdoch