[R] How to read in dataframe from file

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Wed Mar 13 14:48:16 CET 2002

ripley at stats.ox.ac.uk writes:

> On Wed, 13 Mar 2002, Lukas Kubin wrote:
> > I need to read in a dataframe stored in a cvs file. The problem is I don't
> > know how to tell R the first column (in format like "7-Jan-80") is a
> > vector of dates.
> > Could you help me, please?
> It seems unlikely to me that the dataframe is stored in a cvs file. (A
> dataframe is an R object.)  So let me guess that you have a text file
> stored under cvs, which you need to read into R.  The tool to do so is
> read.table, and you should read the column as a character vector, then
> call as.POSIXct(strptime()) on it, to convert it to a "POSIXct" date-time
> column.

..or perhaps it is a csv file (comma separated variables),
in which case, substitute read.csv().

   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list