[R] character string to name
ggrothendieck at gmail.com
Mon Jul 9 14:32:15 CEST 2007
Is one of these alternatives what you want?
x <- list()
x[["y"]] <- 1:4
x <- as.data.frame(x)
x <- data.frame(1:4)
names(x) <- "y"
x <- as.data.frame(sapply("y", function(x, y) y, 1:4, simplify = FALSE))
On 7/9/07, Jim Lemon <jim at bitwrit.com.au> wrote:
> Hi folks,
> I thought I recalled a request for turning a character string into an
> object name as in:
> However, as.name and a few other uninformed attempts didn't even come
> close. A search of "character to name" produced no helpful functions.
> This isn't a very urgent request, but if anyone knows some trick to
> perform this transformation, I would like to hear about it. Thanks.
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help