Ok, conversion to POSIXct does the trick - why doesn't tapply work with the
other, not-obviously-improper POSIX type?
(Incidentally, now it gives me more trouble, with sorting - a reproducible
sample coming up in another thread).
--
View this message in context:
http://r.789695.n4.nabble.com/F
On Thu, Sep 9, 2010 at 12:39 PM, Dimitri Shvorob
wrote:
>
> Update: What did make a difference for me - and something that was present in
> Jim's example, but not reproduced by myself initially - was dropping columns
> other than the two involved. When I dropped all columns except for h and
> src,
Update: What did make a difference for me - and something that was present in
Jim's example, but not reproduced by myself initially - was dropping columns
other than the two involved. When I dropped all columns except for h and
src, the sqldf call worked.
... Is it an R bug or what? (I am saying
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
I think your main problem is that you have your time as POSIXlt which
is a multiple valued vector. I converted the 't' to POSIXct, removed
the other POSIXlt value and created a 'h' as the character for the
hour and it works fine:
> str(g)
'data.frame': 6 obs. of 5 variables:
$ price: int 500
> 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
Hi
you has to provide some more info about x e.g. str(x)
x<-data.frame(price=1, h=Sys.time())
r-help-boun...@r-project.org napsal dne 08.09.2010 10:18:52:
>
> Mnay thanks fr suggestions. I am afraid this is one tough daatframe...
>
> > t = sqldf("select h, count(*) from x group by h")
> Err
On Wed, Sep 8, 2010 at 4:48 AM, Dimitri Shvorob
wrote:
>
> I was able to aggregate (with sqldf, at least), after saving and re-loading
> the dataframe. My first guess was that h (and/or price?) now being a factor
> - stringsAsFactors = T by default - made the difference, and I tried to
> convert x
I was able to aggregate (with sqldf, at least), after saving and re-loading
the dataframe. My first guess was that h (and/or price?) now being a factor
- stringsAsFactors = T by default - made the difference, and I tried to
convert x$h to factor, but received an error.
--
View this message in co
Mnay thanks fr suggestions. I am afraid this is one tough daatframe...
> t = sqldf("select h, count(*) from x group by h")
Error in sqliteExecStatement(con, statement, bind.data) :
RS-DBI driver: (error in statement: no such table: x)
In addition: Warning message:
In value[[3L]](cond) : RAW()
On Mon, Sep 6, 2010 at 12:15 PM, Dimitri Shvorob
wrote:
>
> I have a (very big - 1.5 rows) dataframe with a (POSIXt" "POSIXlt") column h
> (hour). Surprisingly, I cannot calculate a simple aggregate over the
> dataframe.
>
>> n.h1 = sqldf("select distinct h, count(*) from x group by h")
> Error i
On Sep 6, 2010, at 12:15 PM, Dimitri Shvorob wrote:
I have a (very big - 1.5 rows) dataframe with a (POSIXt" "POSIXlt")
column h
(hour). Surprisingly, I cannot calculate a simple aggregate over the
dataframe.
n.h1 = sqldf("select distinct h, count(*) from x group by h")
Error in sqliteE
I have a (very big - 1.5 rows) dataframe with a (POSIXt" "POSIXlt") column h
(hour). Surprisingly, I cannot calculate a simple aggregate over the
dataframe.
> n.h1 = sqldf("select distinct h, count(*) from x group by h")
Error in sqliteExecStatement(con, statement, bind.data) :
RS-DBI driver:
13 matches
Mail list logo