On Apr 16, 2010, at 4:42 PM, Jeroen Ooms wrote:
Ah Phil Spector is right, nothing is converted. I'm almost too
embarrassed to
admit it, but actually, it was Excel that tricked me. It displays date
fields differently than they are stored in the csv file, and once
you press
'save', it save
Jeroen Ooms wrote:
Ah Phil Spector is right, nothing is converted. I'm almost too embarrassed to
admit it, but actually, it was Excel that tricked me. It displays date
fields differently than they are stored in the csv file, and once you press
'save', it saves everything to a different format, co
Ah Phil Spector is right, nothing is converted. I'm almost too embarrassed to
admit it, but actually, it was Excel that tricked me. It displays date
fields differently than they are stored in the csv file, and once you press
'save', it saves everything to a different format, completely unasked.
N
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,Volu
On Apr 16, 2010, at 3:57 PM, 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
e-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Jeroen Ooms
> Sent: Friday, April 16, 2010 1:57 PM
> To: r-help@r-project.org
> Subject: Re: [R] read.table behavior for Dates.
>
>
> Yes I know I can manually do it, but I am
Try this:
patt <- "\\d{4}[-/]\\d{2}[-/]\\d{2}" # could be
\\d{2}[-/]\\d{2}[-/]\\d{4}, etc...
idx <- colSums(sapply(myData, regexpr, pattern = patt)) > 0
myData[idx] <- lapply(myData[idx], as.Date)
On Fri, Apr 16, 2010 at 4:57 PM, Jeroen Ooms wrote:
>
> Yes I know I can manually do it, but I am
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)
b
Try this:
myData <-
read.csv("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";,
colClasses = c('Date', rep('numeric', 6)))
On Fri, Apr 16, 2010 at 4:32 PM, Jeroen Ooms wrote:
>
> When read.table imports a table that includes a header c
use the argument colClasses of read.table
Kjetil
On Fri, Apr 16, 2010 at 3:32 PM, Jeroen Ooms wrote:
>
> When read.table imports a table that includes a header called 'Date', it
> tries to recognize the date format. For example, if one imports this data
> from Yahoo finance, the Date column is
When read.table imports a table that includes a header called 'Date', it
tries to recognize the date format. For example, if one imports this data
from Yahoo finance, the Date column is automatically transformed to Y-m-d,
whereis in the data it appears as m/d/Y:
myData <-
read.csv("http://ichart.
11 matches
Mail list logo