Graphics Programs Reference
In-Depth Information
This is the story of FlowingData subscriber counts in January 2010, as
reported by Feedburner, the service that keeps track of how many people
read FlowingData on a daily basis. On January 1, 2010, there were 25,047
subscribers, and by the end of the month, there were 27,611 subscribers.
Probably the most interesting part though was what wasn't reported in the
middle of the month. Did I actually say something to offend 17,000 readers
that made them unsubscribe? Not likely.
Just because it's
data doesn't make
it fact. There can
be typos, errors
in reporting, or
something else
that causes a
misrepresentation
of reality.
Do you remember the first thing to do when you make a graph in R? You
load your data. Use read.csv() to load the data directly from a URL.
subscribers <-
read.csv(“http://datasets.flowingdata.com/flowingdata_subscribers.csv”,
sep=”,”, header=TRUE)
To look at the first five rows of the data, enter the following:
subscribers[1:5,]
And here's what it looks like:
Date Subscribers Reach Item.Views Hits
1 01-01-2010 25047 4627 9682 27225
2 01-02-2010 25204 1676 5434 28042
3 01-03-2010 25491 1485 6318 29824
4 01-04-2010 26503 6290 17238 48911
5 01-04-2010 26654 6544 16224 45521
There are five columns on date, subscribers, reach, item views, and hits.
You care only about subscribers.
You can also incorporate the date, but counts are already in chronological
order, so you actually don't need the first column to plot subscribers. To
plot the points, enter the following, and you'll get the result in Figure 4-26.
plot(subscribers$Subscribers)
easy, right? The plot() function actually enables you to make several dif-
ferent types of graphs, but the point type is the default. You used only the
subscriber counts. When you provide only one data array to the plot()
function, it assumes that the array contains values, and it automatically
generates an index for the x-coordinates.
Search WWH ::




Custom Search