Hello all I would like to ask your help use mapply. I have a function called findCell that takes two arguments(x,sr) where x is a vector of size two (e.g x<-c(2,3) and sr is a matrix.
I would like to call many times the findCell function (thus I need mapply) for different x inputs but always for the same sr. as x is a vector of size two (two cells) I want to pass inside inside the following 2*10 matrix. -The first input is the two elements of the first row cbin(test[1,1],test[1,2]) -the second input is cbind(test[2,1],test[2,2] -the third input is cbind(test[3,1],test[3,2] and so on This is the str: str(cbind(test[,1],test[,2])) num [1:30, 1:2] -1 -0.667 -0.333 0 0.333 ... so I tried the following: > mapply(findCell,x=cbind(test[,1],test[,2]),sr=sr) Error in if (!is.finite(length.out) || length.out < 0L) stop("length must be non-negative number") else if (length.out == : missing value where TRUE/FALSE needed Calls: mapply -> .Call -> <Anonymous> -> seq -> seq.default I have spend time reading the ?mapply but I am not sure what is the problem here. Could you please help me understand what is missing? Best Regards Alex ______________________________________________ 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.