Will something like the %in% statements below help?
x1 <- 1
x2 <- 5
y1 <- c(2,3)
y2 <- c(4,5)
y3 <- c(7,8)
x1 %in% y1 ||x2 %in% y2
x1 %in% y1 ||x2 %in% y3
--- On Tue, 7/20/10, Jim Maas wrote:
> From: Jim Maas
> Subject: [R] simplify if statement in R ?
>
On 20/07/2010 2:11 PM, Jim Maas wrote:
I found a form of the if statement that works but it is very long. I'm
attempting to check the value of of two different variables to see if
they evaluate to either of two different values, which will result in a
division by 0 in the final equation. This
Hi Jim,
Without a reproducible example I can't test my solution against yours,
but does this do what you are looking for?
#Some Sample data
x0.trial01 <- 1
x1.trial01 <- 2
npt01 <- 2
if(any(c(x0.trial01, x1.trial01) %in% c(0, npt01))) {
x0.trial01.in <- x0.trial01 + 0.5
x1.trial01.in <- x1.t
I found a form of the if statement that works but it is very long. I'm
attempting to check the value of of two different variables to see if
they evaluate to either of two different values, which will result in a
division by 0 in the final equation. This first if statement works for me
__
4 matches
Mail list logo