h Rui's result
identical(Reduce(`&`,result),Reduce(`&`,resultnew))
[1] TRUE
identical(Reduce(`|`,result),Reduce(`|`,resultnew))
[1] TRUE
A.K.
- Original Message -
From: Christof Kluß
To: r-h...@stat.math.ethz.ch
Cc: r-help@r-project.org
Sent: Friday, July 6, 2012 2:42 AM
Subje
Hi Rui Barradas
thank you very much, that's what I searched for
result <- lapply(conds, fun, DF) works, if
day <- DF$day
val <- DF$val
Thanks
Christof
Am 02-07-2012 20:44, schrieb Rui Barradas:
> Hello,
>
> I'm not sure if this is what you want.
>
>
> #-- Make up a dataset
>
Christof,
This isn't quite what you asked for, but perhaps you will find it useful.
You could save the conditions by putting them in a function.
Then you could apply that function to any data frame with the reference
variables.
For example,
check.conditions <- function(df) {
cbind(a=df$
Hello,
I'm not sure if this is what you want.
#-- Make up a dataset
set.seed(1)
n <- 1e2
DF <- data.frame(year=2010 + sample(3, n, TRUE),
day=sample(365, n, TRUE),
val=sample(100, n, TRUE))
a = "day > 100"; b = "val < 50"; c = "year == 2012"
conds <-
Hi
how would you save conditions like
a = "day > 100"; b = "val < 50"; c = "year == 2012"
in a list? I like to have variables like "day", "val", "year" and a list
of conditions list(a,b,c). Then I want to check if a & b & c is true or
if a | b | c is true or similar things.
Greetings
Christof
5 matches
Mail list logo