dimanche 8 novembre 2015

Function that can recieve different type of arguments

I'm trying to write function that can receive only data frame contains two numeric vectors or two numeric vectors. But I cannot write if function properly.

lad=function(...){
  z=(...);
if (!is.data.frame(z) & length(z)!=2 | !is.vector(z[[1]] & !is.vector(z[[2]] & length(a[[1]])!=length(a[[2]])) stop ('arguments must contain data frame or two vectors')

}

Where is the problem here?

Aucun commentaire:

Enregistrer un commentaire