Thanks so much, A.K.
Problem well solved.
Atem.





On Sunday, November 17, 2013 1:28 AM, arun <smartpink...@yahoo.com> wrote:
 
Hi,
Try:
dat1 <- 
read.csv("precipitationRglimclim.csv",header=TRUE,stringsAsFactors=FALSE,sep="\t")
library(reshape2)
dat2M <- melt(dat1,id.var=c("year","month","day"))
dat2M1 <- dat2M[with(dat2M,order(year,month,day,variable)),]
 dim(dat2M1)
#[1] 1972320       5
 row.names(dat2M1) <- 1:nrow(dat2M1)
 colnames(dat2M1)[4:5] <- c("site","rain")


16436*120
#[1] 1972320

A.K.







On Saturday, November 16, 2013 11:28 PM, Zilefac Elvis <zilefacel...@yahoo.com> 
wrote:

Hello AK,
I would like to melt the attached dataframe (precipitationRglimclim.csv) into a 
format as in sampleRglimclim.csv.
I tried doing it using the reshape2 package but did not succeed.

Explanation: The daily data is for 120 sites (G1...G120). For each year, there 
are 12 months and for each month, there are 1...28 or 30 or 31 days.
Melt the dataframe such that each day in a month has 120 values corresponding 
to the 120 sites.

If you need further explanation let me know.
Thanks so much.
Atem.
        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to