Friends, Could anyone help me the script, how to read the more than 15 columns from the file. I have Excel sheet, of course can save into any readable format. Appreciate your help. Thanks. -- View this message in context: http://r.789695.n4.nabble.com/How-to-read-20-columns-from-the-file-tp3664477p3664477.html Sent from the R help mailing list archive at Nabble.com.
save it as .csv, then use read.csv("your_file.csv") On Wed, Jul 13, 2011 at 6:23 PM, Kishorenalluri <kishorenalluri.au at gmail.com> wrote:> Friends, > ? ? ? ? ?Could anyone help me the script, how to read the more than 15 > columns from the file. I have Excel sheet, of course can save into any > readable format. Appreciate your help. > > Thanks. > > -- > View this message in context: http://r.789695.n4.nabble.com/How-to-read-20-columns-from-the-file-tp3664477p3664477.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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. >
Hi Jim, Saving is not a problem. I wanted to load/read the columns from the file followed by plotting the area plot using ggplot2. I am a basic user. I am trying to reproduce the plot similar to the example given here. http://processtrends.com/images/RClimate_NINO_34_latest.png Thanks & Regards -- View this message in context: http://r.789695.n4.nabble.com/How-to-read-20-columns-from-the-file-tp3664477p3664869.html Sent from the R help mailing list archive at Nabble.com.
Hi Kishore, There should be no problem reading in your data if you have followed the directions posted by Jim and myself. I suggest you do a search for a basic R tutorial and follow that through. Steve On Wed, Jul 13, 2011 at 10:08 PM, Kishorenalluri <kishorenalluri.au at gmail.com> wrote:> Hi Jim, > ? ? ? ?Saving is not a problem. I wanted to load/read the columns from the > file followed by plotting the area plot using ggplot2. > > I am a basic user. I am trying to reproduce the plot similar to the example > given here. > http://processtrends.com/images/RClimate_NINO_34_latest.png > > Thanks & Regards > > -- > View this message in context: http://r.789695.n4.nabble.com/How-to-read-20-columns-from-the-file-tp3664477p3664869.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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. >
On 07/13/2011 10:08 PM, Kishorenalluri wrote:> Hi Jim, > Saving is not a problem. I wanted to load/read the columns from the > file followed by plotting the area plot using ggplot2. > > I am a basic user. I am trying to reproduce the plot similar to the example > given here. > http://processtrends.com/images/RClimate_NINO_34_latest.png >Hi Kishorenalluri, How about this? # download the data file from NOAA # http://www.cpc.ncep.noaa.gov/data/indices/wksst.for # make the columns match the header row with a global # replace of "-" with " -" (add a space) # then this seems to reproduce the plot you indicated plot(as.Date(sst$Week,"%d%b%Y"),sst$SSTA1,type="h", col=2+2*(sst$SSTA1<0), main="Sea surface anomalies from NOAA", xlab="Year",ylab="Temperature anomaly") Jim
On 07/14/2011 10:35 PM, Jim Lemon wrote:> On 07/13/2011 10:08 PM, Kishorenalluri wrote: >> Hi Jim, >> Saving is not a problem. I wanted to load/read the columns from the >> file followed by plotting the area plot using ggplot2. >> >> I am a basic user. I am trying to reproduce the plot similar to the >> example >> given here. >> http://processtrends.com/images/RClimate_NINO_34_latest.png >> > Hi Kishorenalluri, > How about this? > > # download the data file from NOAA > # http://www.cpc.ncep.noaa.gov/data/indices/wksst.for > # make the columns match the header row with a global > # replace of "-" with " -" (add a space) > # then this seems to reproduce the plot you indicated > plot(as.Date(sst$Week,"%d%b%Y"),sst$SSTA1,type="h", > col=2+2*(sst$SSTA1<0), > main="Sea surface anomalies from NOAA", > xlab="Year",ylab="Temperature anomaly") >Oops, forgot to include the line reading in the data file: sst<-read.table("sst_1990_2011.dat",header=TRUE) Jim