El Nino and ggplot2

January 21, 2013
By

(This article was first published on Random Miner, and kindly contributed to R-bloggers)

Some days ago i’ve got stucked in what appears to be a simple task: read some El Nino data, and then plot it. The problem was the data file format, which you can find here: El Nino Data.

There’s a mix between ‘white space’ and ‘.’ characters, so read.csvor read.table won’t work. It happens this is called a fixed width format, and R has the mighty read.fwf() function to save us a lot of work. So let’s put this into action together with ggplot2!

The code below shows how to use the read.fwf() function and then it’s pure ggplot2 stuff. Enjoy it!

To leave a comment for the author, please follow the link and comment on their blog: Random Miner.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)