Re: [R] Data Frame Transpose

2010-01-06 Thread Uwe Ligges
On 06.01.2010 03:14, Noli Sicad wrote: Hi John Thanks for your reply. I think I was posting properly the problem. Here are the error, R script and console errors below. Thanks. Noli ~~~ The error: ~~ Error in data.frame(CROP_ID = x[1, 1], CROPTYPE = x[1, 2], name = colnames(x)[4:5],

Re: [R] Data Frame Transpose

2010-01-05 Thread Noli Sicad
Hi John Thanks for your reply. I think I was posting properly the problem. Here are the error, R script and console errors below. Thanks. Noli ~~~ The error: ~~ Error in data.frame(CROP_ID = x[1, 1], CROPTYPE = x[1, 2], name = colnames(x)[4:5], : subscript out of bounds ~~~ I

Re: [R] Data Frame Transpose

2010-01-05 Thread John Kane
Well, if nothing else, you have missing comma. :) x01=y[,1]), x01=y[,1], x02=y[,2], x03=y[,3] -- > > fn <- function(x) { >   y <- t(x[,2]) >   data.frame( Croptype=x[1,1], Period =x[1,2], > name=colnames(x)[2], > x01=y[,1])x01=y[,1], x02=y[,2], x03=y[,3] } > <---Problem > h

[R] Data Frame Transpose

2010-01-05 Thread Noli Sicad
Hi, forests <- read.csv("C:\\Down2\\R_forestmgt\\forest_cut-Age.csv") m <- forests fn <- function(x) { y <- t(x[,2]) data.frame( Croptype=x[1,1], Period =x[1,2], name=colnames(x)[2], x01=y[,1])x01=y[,1], x02=y[,2], x03=y[,3] } <---Problem here m <- do.call( "rbind", lapply(split