Archives
Categories
Category Archives: R
Plotting With Custom X Axis Labels in R — Part 5 in a Series
This is post #05 in a running series about plotting in R. There are a variety of ways to control how R creates x and y axis labels for plots. Let’s walk through the typical process of creating good labels … Continue reading
Plotting Multiple Series in R — Part 4 in a Series
This is post #04 in a running series about plotting in R. Frequently, you want to simultaneously plot multiple series on the same plot. Let’s try plotting daily observations along with a 30 day moving average. To start, I have … Continue reading
Comparing Many Variables in R with Plots — Part 3 in a Series
This is post #03 in a running series about plotting in R. Say you have a data frame with a number of variables that you would like to compare against each other. While you could plot them all on the … Continue reading
Saving Plots in R — Part 2 of a Series
This is post #02 in a running series about plotting in R. Though the docs are relatively clear on how to save an R plot to disk in a variety of formats, I had some trouble figuring out how because … Continue reading
Basic Plotting in R — Part 1 of a Series
This is post #01 in a running series about plotting in R. So, say you have some data that you would like to plot in R. In future entries I’ll discuss plotting multiple series, multiple axes, manipulating axis names and … Continue reading
Eval in R: Running Code From a String
It’s (very) occasionally quite useful to be able to execute code from a string, similarly to eval in ruby or javascript. You might use this to, eg, read a directory full of csv files and turn each filename into a … Continue reading
Posted in R, R Tip
Leave a comment
Column Names of R Data Frames
Say you read a data frame from a file but you don’t like the column names. Here’s how you go about labelling them as you like. Start with a simple csv file: col1, col2, col3 “1,233″, “$12.79″, “$1,333,233.17″ “470″, “$1,113.22″, … Continue reading
Posted in Data Munging, R
Leave a comment
Cleaning Data in R: csv files
When you read csv files, you regularly encounter Excel encoded csv files which include extraneous characters such as commas, dollar signs, and quotes. Such a file might look like col1, col2, col3 “1,233″, “$12.79″, “$1,333,233.17″ “470″, “$1,113.22″, “$0.12″ and call … Continue reading
Posted in Data Munging, R
1 Comment
Using R
I intend to talk about a bunch of things, mostly involving R, that I had to learn the hard way. Hopefully this will not only serve as a set of notes for me but help someone else out along the … Continue reading
Posted in R
Leave a comment