Filter/Ceiling for unwanted data - zoo

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Filter/Ceiling for unwanted data - zoo

knavero
Here's my script:

http://pastebin.com/zx3TCtXg

I want to draw attention to the code block where the read in of the raw data is located. Is there a function that filters out unwanted data with respect to a ceiling limit. For example, I want to remove any value over 500 kW in the rawCool variable. Any ideas where to go with that? I figure it would be an argument within read.zoo or an external function that manipulates the zoo vector that was read in prior. I plan on looking into the zoo FAQ and the R manual '?'. Any help pushing me towards the right direction is much appreciated.
Reply | Threaded
Open this post in threaded view
|

Re: Filter/Ceiling for unwanted data - zoo

knavero
thinking of using an "ifelse" statement, curious if there's a more elegant way of going about this
Reply | Threaded
Open this post in threaded view
|

Re: Filter/Ceiling for unwanted data - zoo

Gabor Grothendieck
In reply to this post by knavero
On Mon, Mar 5, 2012 at 3:33 PM, knavero <[hidden email]> wrote:

> Here's my script:
>
> http://pastebin.com/zx3TCtXg
>
> I want to draw attention to the code block where the read in of the raw data
> is located. Is there a function that filters out unwanted data with respect
> to a ceiling limit. For example, I want to remove any value over 500 kW in
> the rawCool variable. Any ideas where to go with that? I figure it would be
> an argument within read.zoo or an external function that manipulates the zoo
> vector that was read in prior. I plan on looking into the zoo FAQ and the R
> manual '?'. Any help pushing me towards the right direction is much
> appreciated.
>

If z is a zoo object then any of the last three lines returns those
rows of z for which a > 3 and b > 3:

library(zoo)
z <- zoo(cbind(a = 1:10, b = 10:1), as.Date("2000-01-01") + 0:9)

z[ z$a > 3 & z$b > 3, ]
# or
with(z, z[a > 3 & b > 3, ])
# or
subset(z, a > 3 & b > 3)

Also, please read the last line of every message to r-help and provide
examples that are reproducible/self-contained and minimal.

--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

______________________________________________
[hidden email] 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.