[R] logical test not functioning correctly on zoo series...what the hell?
R. Michael Weylandt
michael.weylandt at gmail.com
Wed Mar 14 21:25:12 CET 2012
Just took a closer look at this, Bill Dunlap's guess was correct (mine
wasn't): your data is stored as a character (or at least, mine is
after the commands below) -- character sorting is highly platform
dependent so that's probably why I got a different answer than you.
rawData <- zoo(as.numeric(coredata(rawData)), index(rawData))
should fix your problem.
dput() or str() are good for revealing these sorts of things.
Michael
On Wed, Mar 14, 2012 at 4:11 PM, R. Michael Weylandt
<michael.weylandt at gmail.com> wrote:
> That sure doesn't resemble the output of dput().....
>
> Still, I ran the following:
>
> rawData <- read.zoo("dataout_2471_843.csv", header = TRUE, FUN =
> as.chron, format = "%m/%d/%Y %H:%M", index.column = 2, sep = ",",
> aggregate = function(x) tail(x,1))
> rawData$Meter.ID = NULL
> rawData[rawData$KW.ch..1..set.0. > 0]
>
> per your pastebin and everything works as one might expect.
>
> Please repeat those commands in a fresh (--vanilla with --no-restore)
> R session to verify that you still have this problem and if you still
> do please give us dput(rawData) as both Bill Dunlap and I asked.
>
> Michael
>
>
> On Wed, Mar 14, 2012 at 12:43 PM, knavero <knavero at gmail.com> wrote:
>> attached http://r.789695.n4.nabble.com/file/n4472408/dataout_2471_843.csv
>> dataout_2471_843.csv
>>
>> --
>> View this message in context: http://r.789695.n4.nabble.com/logical-test-not-functioning-correctly-on-zoo-series-what-the-hell-tp4471654p4472408.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> R-help at 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.
More information about the R-help
mailing list