[R] Failure to aggregate

Dimitri Shvorob dimitri.shvorob at gmail.com
Thu Sep 9 17:16:32 CEST 2010


> 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(list(sec = c(24.133, 
    47.096, 12.139, 18.142, 10.721, 28.713), 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")), 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 = structure(list(sec = c(0, 0, 0, 0, 0, 0), min = c(0L, 
    0L, 0L, 0L, 0L, 0L), 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")), 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")
Loading required package: tcltk
Loading Tcl/Tk interface ... done
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-tp2528613p2533051.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list