[R] How to read 20 columns from the file

Jim Lemon jim at bitwrit.com.au
Thu Jul 14 14:35:23 CEST 2011


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



More information about the R-help mailing list