This function creates a multivariate grid. Each column of the input x
is turned
(independently) into a vector of grid values via univariate_grid()
.
Combinations are then formed by calling expand.grid()
.
A vector, matrix, or data.frame to turn into a grid of values.
Controls the approximate grid size. If x
has p columns, then each
(non-discrete) column will be reduced to about the p-th root of grid_size
values.
The default c(0.01, 0.99)
means that values outside the
1% and 99% quantiles of non-discrete numeric columns are removed before calculation
of grid values. Set to 0:1
for no trimming.
How to find grid values of non-discrete numeric columns?
Either "uniform" or "quantile", see description of univariate_grid()
.
Should missing values be dropped from the grid? Default is TRUE
.
A vector, matrix, or data.frame with evaluation points.
multivariate_grid(iris[1:2], grid_size = 4)
#> Sepal.Length Sepal.Width
#> 1 4.4 2.2
#> 2 7.7 2.2
#> 3 4.4 4.2
#> 4 7.7 4.2
multivariate_grid(iris$Species) # Works also in the univariate case
#> [1] setosa versicolor virginica
#> Levels: setosa versicolor virginica