Skip to content
Back to formatted view

Raw Message

Message-ID: <CABaJH796my0j2qOb_rDuRoHw9eMyvFgh+tPzbt1S4-Lb+57GFw@mail.gmail.com>
Date: 2012-05-10T13:18:27Z
From: eddie smith
Subject: Output result to a csv file

Hi guys,

I am applying linear regression model using lm, generate the residual
and then need to output the result to a csv file. Here is my script:
maxtempstation1.lm = lm( Year ~ station1, data=opencsv)
maxstation1.res = resid(maxstation1.lm); maxstation1.res
write.csv(maxtempstation1.res, file="maxtempstation1.csv")

I can do that without problem, but I have 300 stations!. The general
idea is to get all the residuals(for all years) into one csv file.
Here is a sample of my data.

Year ??st1     st2     st3    st4     st5    st6     st7    st8
1982 27.75 27.84 29.81 28.24 29.08 27.97 28.92 28.2
1983 28.74 28.71 29.32 29.34 29.48 28.99 29.45 29.43
1984 28.13 28.34 29.64 28.03 28.85 28.03 28.61 28.08

Anybody willing to help?

Thanks in advance guys.

Eddie