[R] Reshaping and plotting tabular data

From: tsippel <tsippel_at_gmail.com>
Date: Thu, 14 Apr 2011 07:34:30 -1000


Hi-
Tabular data have been provided to me within .csv files. I need to transform the data from tabular format into a dataframe with three columns. The columns need to be the table row id, table column id, and the tabulated variable. An example dataset can be downloaded here:

https://docs.google.com/leaf?id=0B0d3zfSSPFQsOGFkYThhYTYtOTE2Zi00NTNkLThmMzYtNDEyMTY5MjRiN2Qy&sort=name&layout=list&num=50

So I need that to be like:

Season Area Variable
2009-10 38 5
2008-09 38 NA
...etc
2009-10 39 1
2008-09 39 3
...etc

>From there I need to show 'Variable' as a series of bubbles scaled to
summary categories of 'Variable'.
If x is my object storing the data frame above, something like:

x$var.cat[x$Variable %in% 1:5] <- 1
x$var.cat[x$Variable %in% 6:10] <- 2

plot(x=x$Area, y=x$Season, type='n')
points(x=x$Area, y=x$Season, pch=1, cex=x$var.categ)

Transforming tabular data has turned out to be trickier than I expected and I would appreciate advice. Although my bubble plot scheme should work, it would be nice to hear of better ways on that too...

Thanks,
Tim

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 14 Apr 2011 - 17:39:02 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 14 Apr 2011 - 18:10:31 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive