Hi Robert,
Consider the following:
x <- c(1, 3, 5, 4, 6)
ifelse(x < 6 & x > 1, 1, 2)
[1] 2 1 1 1 2
HTH,
Jorge
On Fri, May 21, 2010 at 9:36 AM, Robert U <> wrote:
> Dear
> R-users,
>
>
>
> I've been trying to write a script but i encounter much problems with basic
> functions.. That is, i try
Example:
if (abs(-1-1) <= 3 & abs(1+1) <= 3) {print(1)} else {print(2)}
Contact
Details:---
Contact me: tal.gal...@gmail.com | 972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statis
You need parentheses enclosing the entire if() statement:
if(something & somethingelse) {
do this
}
Sarah
On Fri, May 21, 2010 at 9:36 AM, Robert U wrote:
> Dear
> R-users,
>
>
>
> I've been trying to write a script but i encounter much problems with basic
> functions.. That is, i try to wri
Dear
R-users,
I've been trying to write a script but i encounter much problems with basic
functions.. That is, i try to write a simple IF ELSE statement, with 2
requirements for the IF :
if (abs(x + Dataset$LAT[1]) <= 3) and (abs(y + Dataset$LONG[1]) <= 3) {z
<- 1} else {z <-0}
This does n
4 matches
Mail list logo