@@ -30,7 +30,7 @@ plot.design <-
3030	    stop(" 'y' must be a numeric vector" 
3131	if (! is.data.frame(x )) #  or allow factor (see 2 lines below)?? {FIXME}
3232	    stop(" 'x' must be a data frame" 
33- 	if (! all(sapply (x , is.factor )) &&  ! is.factor(x )) #  incl "ordered"
33+ 	if (! all(vapply (x , is.factor ,  NA )) &&  ! is.factor(x )) #  incl "ordered"
3434	    stop(" all columns/components of 'x' must be factors" 
3535	k  <-  ncol(x )
3636        if (anyNA(y )) {
@@ -75,17 +75,17 @@ plot.design <-
7575	    x  <-  stats :: model.frame(y  , data  =  x )
7676	}
7777	else  if (is.numeric(y )) {
78- 	    x  <-  cbind(y ,x [,sapply (x , is.factor )])
78+ 	    x  <-  cbind(y ,  x [, vapply (x , is.factor ,  NA )])
7979	    tmpname  <-  match.call()
8080	    names(x ) <-  as.character(c(tmpname [[3L ]],names(x [,- 1 ])))
8181	}
8282	else  if (is.character(y )) {
8383	    ynames  <-  y 
8484	    y  <-  data.frame (x [,y ])
85- 	    if (sum(sapply (y , is.numeric )) !=  ncol(y )) {
85+ 	    if (sum(vapply (y , is.numeric ,  NA )) !=  ncol(y )) {
8686		stop(" a variable in 'y' is not numeric" 
8787	    }
88- 	    x  <-  x [,sapply (x , is.factor )]
88+ 	    x  <-  x [, vapply (x , is.factor ,  NA )]
8989	    xnames  <-  names(x )
9090	    x  <-  cbind(x ,y )
9191	    names(x ) <-  c(xnames ,ynames )
@@ -98,8 +98,8 @@ plot.design <-
9898	x  <-  stats :: model.frame(x )
9999    }
100100
101-     i.fac  <-  sapply (x , is.factor )
102-     i.num  <-  sapply (x , is.numeric )
101+     i.fac  <-  vapply (x , is.factor ,  NA )
102+     i.num  <-  vapply (x , is.numeric ,  NA )
103103    nResp  <-  sum(i.num )
104104    if  (nResp  ==  0 )
105105	stop(" there must be at least one numeric variable!" 
0 commit comments