[R] read.table behavior for Dates.

Phil Spector spector at stat.berkeley.edu
Fri Apr 16 22:22:43 CEST 2010


Jeroen -
    read.table is not converting anything.  You're confusing
the output you see at yahoo with the contents of the csv file.

> two  = readLines("http://ichart.finance.yahoo.com/table.csv?s=GOOG&a=07&b=19&c=2004&d=03&e=16&f=2010&g=d&ignore=.csv")
> two[1:3]
[1] "Date,Open,High,Low,Close,Volume,Adj Close" 
[2] "2010-04-15,592.17,597.84,588.29,595.30,6716700,595.30"
[3] "2010-04-14,590.06,592.34,584.01,589.00,3402700,589.00"

This shows that the dates have been faithfully copied from the 
csv file with no conversion.

 					- Phil Spector
 					 Statistical Computing Facility
 					 Department of Statistics
 					 UC Berkeley
 					 spector at stat.berkeley.edu


On Fri, 16 Apr 2010, Jeroen Ooms wrote:

>
> Yes I know I can manually do it, but I am using it for scripts in which users
> upload files. Hence, I don't know what's going to come; I don't know on
> before hand whether data will contain Dates, and in which columns they
> appear. This is why I was surprised that read.table has some (undocumented)
> behavior of converting columns that look like Dates to a different format.
>
> I would like to control this default behavior of the read.table function,
> rather than set a type for a specific column of a specific file.
>
>
> -- 
> View this message in context: http://n4.nabble.com/read-table-behavior-for-Dates-tp2013442p2013489.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>



More information about the R-help mailing list