[R] Output result to a csv file

Rui Barradas ruipbarradas at sapo.pt
Thu May 10 16:51:43 CEST 2012


Hello,

Try

station <- colnames(opencsv)[-1]
mat <- matrix(0, nrow=length(station), ncol=nrow(opencsv))
dimnames(mat) <- list(station, opencsv$Year)
for(st in station){
	model <- lm(Year~opencsv[, st], data=opencsv)
	mat[st, ] <- residuals(model)
}
write.csv(mat, "opencsv.csv")


Hope this helps,

Rui Barradas


--
View this message in context: http://r.789695.n4.nabble.com/Output-result-to-a-csv-file-tp4623510p4623714.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list