Custom Making a Data Frame in R for Graphing Purposes

I have no problems importing all sorts of data sets into R for statistical analysis.  However, there is always the step where I’ve extracted the relevant stats that I want to put into multiple graphs.  When I get the particular stats I need, I usually just stick them in Excel, in tabular form, and then just make my graphs from there.  

Excel is great because it then becomes ridiculously easy to customize my graphs from within.  Today however I kept trying to copy and paste the tables I made in excel back into R to try building some fancy graphs with ggplot2.  I kept getting very frustrated though, because R is very picky about copying and pasting text from Excel.  

I realized that if I want to remove the frustration of copying tables from excel, I should just be constructing these “pre-graph” tables in R instead.

The above represents a very simple example, but essentially I haven’t even been doing anything like the above at work to try to use R graphics instead of Excel graphs.

In sum:

  1. Get the needed stats
  2. Type up a column or more with text items that categorize the stats from step 1
  3. Type up a column with the stats from text 1
  4. Put those columns together in a data frame and chart.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s