You could try using the numeric representation of date, and split the data 
frame using that variable.  For example:

src$date.num <- as.numeric(src$date)

Jean

Franc Lucas wrote on 08/24/2011 02:42:58 PM:
> 
>    Hello everyone,
>    I want to split a data.frame by the column date . The data frame 
looks like
>    this
>    date                  time           open            close
>    02.01.2011    09:00:00      1000             1200
>    02.01.2011    09:05:02      1200             1203
>    ...
>    01.02.2011    10:01:21      1029             1110
>    .....
>    30.03.2011    12:02:12      1231              1200
>    30.03.2011    17:00:00      1200              1190
>    Please  note  that this is the German version of the date notation. 
So
>    02.01.2011 is January 2nd 2011.
>    So the column data is class: character.
>    When I now split the dataframe by date, e.g.
>    Intraday <- split(x=src, f=src$date, drop=FALSE)
>    ..I get a list which is not sorted...for example:  "01.02.2011" 
(February
>    1st) comes before "02.01.2011" (January 2nd).
>    My approach was to transform the column date into POSIXct by using 
strptime
>    (btw: I dont care for the time information):
>    src$date <- strptime(tickdata$date, "%d.%m.%Y")
>    The data frame then looks like this:
>    date                  time           open            close
>    01-02-2011    09:00:00      1000             1200
>    01-02-2011    09:05:02      1200             1203
>    ...
>    02-01-2011    10:01:21      1029             1110
>    .....
>    03-30-2011    12:02:12      1231              1200
>    03-30-2011    17:00:00      1200              1190
>    which is totally fine. But when I now try to split the data frame it 
says,
>    that  I  am  indexing out of bounds... (German: "Fehler in args[[i]] 
:
>    Indizierung außerhalb der Grenzen")
>    Can anybody help me?
>    Thanks in advance!
>    Best
>    Franc
>    BSc. Student
>    University of Mannheim
> 
>    Schon gehört? WEB.DE hat einen genialen Phishing-Filter in die
>    Toolbar eingebaut! [1]http://produkte.web.de/go/toolbar
> 
> References
> 
>    1. http://produkte.web.de/go/toolbar
> ______________________________________________
> R-help@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.

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to