Skip to content
Back to formatted view

Raw Message

Message-ID: <1336661503983-4623714.post@n4.nabble.com>
Date: 2012-05-10T14:51:43Z
From: Rui Barradas
Subject: Output result to a csv file
In-Reply-To: <CABaJH796my0j2qOb_rDuRoHw9eMyvFgh+tPzbt1S4-Lb+57GFw@mail.gmail.com>

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.