[R-sig-DB] Storing data.frame attirbutes in SQL through DBI
Sean Davis
@d@v|@2 @end|ng |rom m@||@n|h@gov
Sat Sep 29 16:45:15 CEST 2007
Iago Mosqueira wrote:
> Hello,
>
> What would be the best way of storing some extra attributes of a
> data.frame on an SQLite database? Am I forced to use a separate table
> for this?
>
That is probably the best way to do it, yes. I would imagine making a
"saveDataFrame" function which would accept a data frame, pull off the
attributes that you want to save, write them into a separate table, then
save the data in the data frame. You might need a third table to store
the name or id of the data frame. You would, of course, need a
"loadDataFrame" function as well as a "deleteDataFrame" function. If
you can abstract all the SQL into a function, then using a three-table
structure for a data frame becomes quite feasible.
You could also look into using something like HDF5 (see the HDF5 package
on cran--I have never used it, though) or the ncdf package, which reads
and writes netcdf files. Both of these provide a way of writing "rich"
data files.
Sean
More information about the R-sig-DB
mailing list