[R] export dataframe's column classes to a list
Peter.Alspach at plantandfood.co.nz
Wed May 19 22:49:24 CEST 2010
Tena koe Allie
do what you want?
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Alexander Shenkin
> Sent: Thursday, 20 May 2010 8:19 a.m.
> To: r-help at r-project.org
> Subject: [R] export dataframe's column classes to a list
> Hi Folks,
> I want to export a dataframe's column classes to a list so that I can
> reinstantiate the dataframe from a CSV file in the future. (I know
> about save(), which I'm using in addition to this).
> what I want to do is the following:
> col_classes = get_col_classes(myframe);
> write.csv(col_classes, "column_classes")
> ... time passes, R gets closed, etc ...
> col_classes = read.csv("column_classes")
> new_myframe = read.csv("myfile.csv", colClasses = col_classes)
> My question is how to construct the "get_col_classes()" function
> Any thoughts are greatly appreciated!
> Alexander Shenkin
> PhD Candidate
> School of Natural Resources and Environment
> University of Florida
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help