[R] best data storage format?

David Winsemius dwinsemius at comcast.net
Fri Sep 18 20:06:06 CEST 2015


On Sep 18, 2015, at 10:30 AM, David Winsemius wrote:

> 
> On Sep 17, 2015, at 1:41 PM, Alfa Diallo wrote:
> 
>> Hello -
>> 
>> I’m working on dataset that will eventually be used in an xyz-plot.
>> 
>> I’m having trouble figuring out the best way to store the data (see an attached .csv sheet exported from Excel). Some information on the data:
>> 
>> - Columns B - F are labels that describe the z data points
>> - Rows above x and y data pairs show the corresponding labels for the data point.
>> 
>> I want to use R to visualize the data and appreciate any feedback on the best mechanism to store/organize the info. I’m new to R and want to start the data assembly on the right foot - thanks for the help and advice!
>> 
>> Alfa
> 
> 
> You later provided a link to a csv version of that dataset. I loaded it into an OpenOffice spreadsheet (because my purchased copy of Excel was no longer functional after a harddisk crash and restore from backup to a different disk and MS now claims to not have any record of it so refuses to let me re-register it to the new disk despite having all the original boxes and fancy security tags.) 
> 
> At any rate, I am attaching a png copy of the data in its original version and in a transposed version what I would suggest is closer to how one might store your data. Presenting pictures of data is almost always a bad idea on Rhelp, but this seems the best way to illustrate the current arrangement.

In the past I had success attaching .png formatted files but it appears to have failed in this instance. The mailing did get shunted to the moderation queue because of the size of the image file, but then got stripped despite being "accepted".  C'est la vie.


>  At the moment you have a mixture of columnar and row-wise storage. You should convert to all columnar. This will require copying the "z" values of interest to new columns after the transpose. You can probably do that in Excel easier than doing it in R. Then when you have an all-columnar arrangement, just use read.csv.


David Winsemius
Alameda, CA, USA



More information about the R-help mailing list