hello r users,

i'm trying to use the apply method on a function with several inputs, but
cannot figure out how to send multiple arguments to the function (not
multiple runs of the same function, but one run of the function including
two variables - each used within the function).

a <- c(1:10,999,999,999)
b <- c(11:20,999,999,999)

tfun <- function(x,y){
  if( (x = 1 & y !=999) || (x > 1 & x < 999 & y == 999) )
    x1 <- 1
  else
    x1 <-0
}

#this doesn't work - gives an error " 'y' is missing
tfilt <- sapply(data.frame(a,b), tfun)

thanks,
joe

-- 
View this message in context: 
http://r.789695.n4.nabble.com/using-the-apply-method-for-functions-with-multiple-inputs-tp3054719p3054719.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org 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.

Reply via email to