Skip to content
Prev 172610 / 398506 Next

how to create many variables at one time?

You can also change the column names to something else en mass:

colnames(dat) <- paste("X",1:100,sep="")

I next tried constructing the X<n> names inside data.frame, but failed  
using the paste function. The help page for data.frame has a paragraph  
that begins "How the names of the data frame are created is complex..."

At least the following will result in names of the form X.1, X.2 ...

dat <- data.frame( X = replicate(100, rnorm(10)) )