[R] data shape

From: Tom Sgouros <tomfool_at_as220.org>
Date: Thu, 20 Dec 2007 09:06:34 -0500


I have been give a spreadsheet to work with formed as one big table. What it consists of is a 10-row-by-40-column table for each of about 70 different locations. In other words, the table row names are repeated 70 times, once for each of the locations (whose names also appear in the same column, where it's talking about the totals for that location), e.g.:

            A B C
 Location1 15 73 123 <- this row is the sum of the following 3  Under 10 6 42 23
 10 - 25 4 15 23
 Over 25 5 16 77
 Location2 18 75 113 <- same here
 Under 10 7 45 13
 10 - 25 5 18 44
 Over 25 6 12 56

I want to get this into R as a collection of data frames, one for each of my locations. My questions:

  1. There is a way to handle a collection of data frames, isn't there? No doubt there are plenty, but what's the easiest way, so that I can address them collectively, allowing me to ask such questions as what's the max of the over 25's in column C?
  2. What's the easiest way to read such a data array from a text file? I can do some editing of a csv file produced from the spreadsheet, but don't really know what to aim for.
  3. Is there some shortcut that would allow me to read this directly from a spreadsheet?

Many thanks,



tomfool at as220 dot org http://sgouros.com http://whatcheer.net ______________________________________________ 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 20 Dec 2007 - 14:25:18 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 20 Dec 2007 - 17:30:20 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.