@@ -210,10 +210,16 @@ check_interface <- function(formula, recipe, x, y, data, cl) {
210210 inher(x , c(" data.frame" , " matrix" , " tbl_spark" ), cl )
211211
212212 # `y` can be a vector (which is not a class), or a factor (which is not a vector)
213- if (! is.null(y ) && ! is.vector(y ))
213+ if (! is.null(y ) && ! is.vector(y ))
214214 inher(y , c(" data.frame" , " matrix" , " factor" , " tbl_spark" ), cl )
215215 inher(data , c(" data.frame" , " matrix" , " tbl_spark" ), cl )
216216
217+ # rule out spark data sets that don't use the formula interface
218+ if (inherits(x , " tbl_spark" ) | inherits(y , " tbl_spark" ))
219+ stop(" spark objects can only be used with the formula interface to `fit` " ,
220+ " with a spark data object." , call. = FALSE )
221+
222+ # Determine the `fit` interface
217223 matrix_interface <- ! is.null(x ) & ! is.null(y ) && is.matrix(x )
218224 df_interface <- ! is.null(x ) & ! is.null(y ) && is.data.frame(x )
219225 rec_interface <- ! is.null(recipe ) & ! is.null(data )
@@ -226,10 +232,14 @@ check_interface <- function(formula, recipe, x, y, data, cl) {
226232 stop(" Too many specifications of arguments; used either 'x/y', " ,
227233 " 'formula/data', or 'recipe/data' combinations." , call. = FALSE )
228234
229- if (matrix_interface ) return (" data.frame" )
230- if (df_interface ) return (" data.frame" )
231- if (rec_interface ) return (" recipe" )
232- if (form_interface ) return (" formula" )
235+ if (matrix_interface )
236+ return (" data.frame" )
237+ if (df_interface )
238+ return (" data.frame" )
239+ if (rec_interface )
240+ return (" recipe" )
241+ if (form_interface )
242+ return (" formula" )
233243 stop(" Error when checking the interface" )
234244}
235245
0 commit comments