Skip to content
Prev 105793 / 398506 Next

how to create data.frame with dynamic count of values

I don't understand what you're asking for.

But if your goal is to create N1 through N15 in order to use them to 
fill a data frame, then it can be much simpler:

items <- 15
VarSize <- 10

tmp <- matrix(0,nrow=VarSize,ncol=items)
tmp <- data.frame(tmp)
names(tmp) <- paste('N',seq(items),sep='')

## of course, this next only works if VarSize <= length(letters)
tmp$X1 <- letters[1:VarSize]

You could instead start with

tmp <- matrix( rnorm(VarSize*items) , nrow=VarSize , ncol=items)

-Don
At 5:17 PM +0100 12/8/06, Knut Krueger wrote: