dimanche 31 août 2014

How to produce frequency polygons for each row of a data frame with an unnamed first column


Vote count:

0






So this is I'm sure a fairly elementary problem. I have a data frame that has data for 10 years for a bunch of countries. It looks like this. The data frame is df.



X2003 X2004 X2005 X2006 X2007 X2008 X2009 X2010 X2011 X2012


Afghanistan 7.321 7.136 6.930 6.702 6.456 6.196 5.928 5.659 5.395 5.141 Albania 2.097 2.004 1.919 1.849 1.796 1.761 1.744 1.741 1.748 1.760 Algeria 2.412 2.448 2.507 2.580 2.656 2.725 2.781 2.817 2.829 2.820 Angola 6.743 6.704 6.657 6.598 6.523 6.434 6.331 6.218 6.099 5.979 Antigua and Barbuda 2.268 2.246 2.224 2.203 2.183 2.164 2.146 2.130 2.115 2.102 Argentina 2.340 2.310 2.286 2.268 2.254 2.241 2.228 2.215 2.201 2.188



The first column is metadata. It hasn't got a name. I'd like to use qplot to plot frequency polygons (basically time series) for each of the rows. Something like the following command: qplot (data = df, binwidth = 1, geom="freqpoly") but I get the following error



Error: stat_bin requires the following missing aesthetics: x. I would like to set x = first column but I don't have a name on that column. Do I have to create a first column of country names? If so, how do I do that? Seems like there should be an easier way. Sorry if this is so elementary.


Thanks for reading!



asked 40 secs ago







How to produce frequency polygons for each row of a data frame with an unnamed first column

Aucun commentaire:

Enregistrer un commentaire