On 11-02-16 16:29, Sam Steingold wrote:

how do I create a data frame with the given column names
_NOT KNOWN IN ADVANCE_?
i.e., I have a vector of strings for names and I want to get an _EMPTY_
data frame with these column names.
is it at all possible?

Read the posting guide, provide example code. Then you could start here:

vstr <- sample(letters, sample(1:20, 1), repl=F)
df <- as.data.frame(matrix(ncol=length(vstr), dimnames=list(NULL, vstr)))
str(df)

HTH, *S*

--
Sascha Vieweg, saschav...@gmail.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