[This article was first published on Random Miner, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
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.csv
or 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 about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.