[R] IF ELSE

jost87 jost87 at hotmail.com
Fri Jan 13 15:31:58 CET 2012


Can somebody explain the problem in the following expression?

Thank you


/> if (species == 1){ 
+                   fitness <-
(1-b)*exp(-((microsites-niche.preference)/(niche.width.specialist+a.specialist)^2)*(1-a.specialist)
+     }else 
Error: unexpected '}' in:
"                  fitness <-
(1-b)*exp(-((microsites-niche.preference)/(niche.width.specialist+a.specialist)^2)*(1-a.specialist)
    }"
>     if (species ==2){
+         fitness <)
(1-b)*exp(-((microsites-niche.preference)/(niche.width.generalist+a.generalist)^2)*(1-a.generalist)
Error: unexpected ')' in:
"    if (species ==2){
        fitness <)"
>         }   else fitness <- 0 
Error: unexpected '}' in "        }"
>     }
Error: unexpected '}' in "    }"/

--
View this message in context: http://r.789695.n4.nabble.com/IF-ELSE-tp4292285p4292285.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list