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$day > 100, b=df$val < 50, c=df$year==2012)
}
mydf <- data.frame(day=c(20, 50, 100, 70, 80, 130), val=c(1, 7, 70, 20,
55, 30), year=2011:2016)
check.conditions(mydf)
a b c
[1,] FALSE TRUE FALSE
[2,] FALSE TRUE TRUE
[3,] FALSE FALSE FALSE
[4,] FALSE TRUE FALSE
[5,] FALSE FALSE FALSE
[6,] TRUE TRUE FALSE
Jean
Christof Kluß <[email protected]> wrote on 07/02/2012 12:04:40 PM:
> 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
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.