On Nov 17, 2010, at 16:37 , Graves, Gregory wrote: > Follows is the exact solution to this: > > v <- NULL > > #note that decreasing is FALSE so preceding year preceeds > > for(i in 2:46) { > kk <- melt(yearmonth[, c(1, i, i+1)], id.vars="month", variable_name="year") > v[[i-1]] <- kk[order(kk$year, decreasing=FALSE),] > } > > x <- do.call(cbind, v) > write.table(x,"clipboard",sep=" ",col.names=NA) #export to Excell via > Ctrl-V >
Just wondering, was anything wrong with y1 <- cbind(yearmonth[,-1], foo = NA) names(y1) <- names(yearmonth) rbind(yearmonth, y1) ? (untested, of course) -- Peter Dalgaard Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd....@cbs.dk Priv: pda...@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.