[R] Failure to aggregate

Dimitri Shvorob dimitri.shvorob at gmail.com
Thu Sep 9 18:27:55 CEST 2010


Thanks a lot, Jim. I am not sure what difference the various POSIXes make -
in the end, you are replacing a datetime hour with a numeric value, e.g., 1
or 9. That does not work for me, unfortunately. 

> g = head(x)
> dput(g)
structure(list(price = c(500L, 500L, 501L, 501L, 500L, 501L), 
    size = c(221000L, 2000L, 1000L, 13000L, 3000L, 3000L), src = c("R", 
    "R", "R", "R", "R", "R"), t = structure(c(1104829224.133, 
    1104829247.096, 1104829272.139, 1104829278.142, 1104829330.721, 
    1104829348.713), class = c("POSIXt", "POSIXct"), tzone = ""), 
    d = structure(list(sec = c(0, 0, 0, 0, 0, 0), min = c(0L, 
    0L, 0L, 0L, 0L, 0L), hour = c(0L, 0L, 0L, 0L, 0L, 0L), mday = c(4L, 
    4L, 4L, 4L, 4L, 4L), mon = c(0L, 0L, 0L, 0L, 0L, 0L), year = c(105L, 
    105L, 105L, 105L, 105L, 105L), wday = c(2L, 2L, 2L, 2L, 2L, 
    2L), yday = c(3L, 3L, 3L, 3L, 3L, 3L), isdst = c(0L, 0L, 
    0L, 0L, 0L, 0L)), .Names = c("sec", "min", "hour", "mday", 
    "mon", "year", "wday", "yday", "isdst"), class = c("POSIXt", 
    "POSIXlt")), h = c(9, 9, 9, 9, 9, 9), m = structure(list(
        sec = c(0, 0, 0, 0, 0, 0), min = c(0L, 0L, 1L, 1L, 2L, 
        2L), hour = c(9L, 9L, 9L, 9L, 9L, 9L), mday = c(4L, 4L, 
        4L, 4L, 4L, 4L), mon = c(0L, 0L, 0L, 0L, 0L, 0L), year = c(105L, 
        105L, 105L, 105L, 105L, 105L), wday = c(2L, 2L, 2L, 2L, 
        2L, 2L), yday = c(3L, 3L, 3L, 3L, 3L, 3L), isdst = c(0L, 
        0L, 0L, 0L, 0L, 0L)), .Names = c("sec", "min", "hour", 
    "mday", "mon", "year", "wday", "yday", "isdst"), class = c("POSIXt", 
    "POSIXlt")), s = structure(list(sec = c(24, 47, 12, 18, 10, 
    28), min = c(0L, 0L, 1L, 1L, 2L, 2L), hour = c(9L, 9L, 9L, 
    9L, 9L, 9L), mday = c(4L, 4L, 4L, 4L, 4L, 4L), mon = c(0L, 
    0L, 0L, 0L, 0L, 0L), year = c(105L, 105L, 105L, 105L, 105L, 
    105L), wday = c(2L, 2L, 2L, 2L, 2L, 2L), yday = c(3L, 3L, 
    3L, 3L, 3L, 3L), isdst = c(0L, 0L, 0L, 0L, 0L, 0L)), .Names = c("sec", 
    "min", "hour", "mday", "mon", "year", "wday", "yday", "isdst"
    ), class = c("POSIXt", "POSIXlt"))), .Names = c("price", 
"size", "src", "t", "d", "h", "m", "s"), row.names = c(NA, 6L
), class = "data.frame")

> n = sqldf("select distinct h, src, count(*) from g group by h, src")
Error in sqliteExecStatement(con, statement, bind.data) : 
  RS-DBI driver: (error in statement: no such table: g)
In addition: Warning message:
In value[[3L]](cond) : RAW() can only be applied to a 'raw', not a 'double'




-- 
View this message in context: http://r.789695.n4.nabble.com/Failure-to-aggregate-tp2528613p2533189.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list