Thanks for the help guys. This worked:
x<-sqlQuery(conn, "select to_char(lsd,'-mm') as yr,ttl_mo_prcp from
mo_rains where stn_num=23090")
myDF=x
myDF[,1]=as.yearmon(myDF[,1])
myDF$R=myDF$TTL_MO_PRCP
myDF[,-2]
myDF$<-substr(myDF$YR,5,8)
myDF$mm<-substr(myDF$YR,1,4)
myDF<-subset(myDF, se
Try this:
Lines <- "-mm Rainfall(mm)
1 1977-0217.4
2 1977-0334.0
3 1977-0426.2
4 1977-0542.6
5 1977-0658.6
6 1977-0723.2
7 1977-0826.8
8 1977-0948.4
9 1977-1047.0
10 1977-1137.2
11 1977-
On Feb 15, 2010, at 1:22 AM, milton ruser wrote:
Hi Raging Jim
may be this is a starting point.
myDF<-read.table(stdin(),head=T,sep=",")
Those "mm" entries will become factors, which can lead to
confusion for newbies. Might be more straightforward to always use
stringsAsFactors=FALS
Hi Raging Jim
may be this is a starting point.
myDF<-read.table(stdin(),head=T,sep=",")
mm,Rainfall
1977-02,17.4
1977-03,34.0
1977-04,26.2
1977-05,42.6
1977-06,58.6
1977-07,23.2
1977-08,26.8
1977-09,48.4
1977-10,47.0
1977-11,37.2
1977-12,15.0
1978-01,2.6
1978-02,6.8
1978-03,9.0
1978-04,46.6
the other alternative would be to edit my sql query so that that data is
brought in from the database and put in to the correct format initially.
"sqlQuery(conn, "select lsd,ttl_mo_prcp from mo_rains where stn_num=23090")"
That is my very basic query. I have also been given this for use in orcal
Dear anyone who knows more about R than me (so everyone). I have been bashing
my head on the keyboard all day trying to do something with my table.
I have some data, like so:
-mm Rainfall(mm)
1 1977-0217.4
2 1977-0334.0
3 1977-0426.2
4 1977-054
6 matches
Mail list logo