[R] help on output my own function result in ddply

JS Huang js.huang at protective.com
Fri Mar 6 02:28:04 CET 2015


Hi, 

  There is a lot of if-else statement.  r syntax rejects them.  Here is an
example of if-else example.  In r we can code *ifelse(x>2,y <-
1,ifelse(x>1,y <- 0.5, y <- 0))* for the following.

if (x > 2) 
{
  y = 1
}
else
{
  if (x > 1)
  { 
     y = 0.5
  }
  else 
  {
     y = 0
  }
}




-----
JS Huang
--
View this message in context: http://r.789695.n4.nabble.com/help-on-output-my-own-function-result-in-ddply-tp4704238p4704240.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list