Hi R-helpers, I would like to make a blank dataframe, i.e. a dataframe without any rows. I would like the blank dataframe (which is to be called merged) to have 0 rows and 32 columns. Once I've made the dataframe, I'll specify the column names using:>names(merged)<-c("GRIDCODE",paste("VALUE",0:3,sep="_"),paste("VALUE",5:30,sep="_"),"AREA") Then I'll add rows to it, using the loop (which is working fine). Thanks for any help! Mark [[alternative HTML version deleted]]
Richard M. Heiberger
2009-Oct-07 23:02 UTC
[R] Make a blank dataframe with given dimensions
> tmp <- data.frame(matrix(nrow=0, ncol=32))> tmp [1] X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 [20] X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 X32 <0 rows> (or 0-length row.names) > names(tmp) <- c(letters, LETTERS[1:6]) > tmp [1] a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F <0 rows> (or 0-length row.names) >