View source: R/visualisation_matrix.R

visualisation_matrix | R Documentation |

This function is an alias (another name) for the `insight::get_datagrid()`

function. Same arguments apply.

```
visualisation_matrix(x, ...)
## S3 method for class 'data.frame'
visualisation_matrix(
x,
at = "all",
target = NULL,
factors = "reference",
numerics = "mean",
preserve_range = FALSE,
reference = x,
...
)
## S3 method for class 'numeric'
visualisation_matrix(x, ...)
## S3 method for class 'factor'
visualisation_matrix(x, ...)
```

`x` |
An object from which to construct the reference grid. |

`...` |
Arguments passed to or from other methods (for instance, |

`at` |
Indicates the -
`"all"` , which will include all variables or predictors. a character vector of one or more variable or predictor names, like `c("Species", "Sepal.Width")` , which will create a grid of all combinations of unique values. For factors, will use all levels, for numeric variables, will use a range of length`length` (evenly spread from minimum to maximum) and for character vectors, will use all unique values.a list of named elements, indicating focal predictors and their representative values, e.g. `at = list(Sepal.Length = c(2, 4), Species = "setosa")` .a string with assignments, e.g. `at = "Sepal.Length = 2"` or`at = c("Sepal.Length = 2", "Species = 'setosa'")` - note the usage of single and double quotes to assign strings within strings.
There is a special handling of assignments with two values, indicating minimum and maximum (e.g. `at = "Sepal.Length = [0, 5]"` ), for which a range of length`length` (evenly spread from given minimum to maximum) is created.more than two numeric values `at = "Sepal.Length = [2,3,4,5]"` , in which case these values are used as representative values.a "token" that creates pre-defined representative values: for mean and -/+ 1 SD around the mean: `"x = [sd]"` for median and -/+ 1 MAD around the median: `"x = [mad]"` for Tukey's five number summary (minimum, lower-hinge, median, upper-hinge, maximum): `"x = [fivenum]"` for terciles, including minimum and maximum: `"x = [terciles]"` for terciles, excluding minimum and maximum: `"x = [terciles2]"` for quartiles, including minimum and maximum: `"x = [quartiles]"` for quartiles, excluding minimum and maximum: `"x = [quartiles2]"` for minimum and maximum value: `"x = [minmax]"` for 0 and the maximum value: `"x = [zeromax]"`
For The remaining variables not specified in |

`target` |
Deprecated name. Please use |

`factors` |
Type of summary for factors. Can be |

`numerics` |
Type of summary for numeric values. Can be |

`preserve_range` |
In the case of combinations between numeric variables
and factors, setting |

`reference` |
The reference vector from which to compute the mean and SD.
Used when standardizing or unstandardizing the grid using |

Reference grid data frame.

```
library(modelbased)
# Add one row to change the "mode" of Species
data <- rbind(iris, iris[149, ], make.row.names = FALSE)
# Single variable is of interest; all others are "fixed"
visualisation_matrix(data, at = "Sepal.Length")
visualisation_matrix(data, at = "Sepal.Length", length = 3)
visualisation_matrix(data, at = "Sepal.Length", range = "ci", ci = 0.90)
visualisation_matrix(data, at = "Sepal.Length", factors = "mode")
# Multiple variables are of interest, creating a combination
visualisation_matrix(data, at = c("Sepal.Length", "Species"), length = 3)
visualisation_matrix(data, at = c(1, 3), length = 3)
visualisation_matrix(data, at = c("Sepal.Length", "Species"), preserve_range = TRUE)
visualisation_matrix(data, at = c("Sepal.Length", "Species"), numerics = 0)
visualisation_matrix(data, at = c("Sepal.Length = 3", "Species"))
visualisation_matrix(data, at = c("Sepal.Length = c(3, 1)", "Species = 'setosa'"))
# with list-style at-argument
visualisation_matrix(data, at = list(Sepal.Length = c(1, 3), Species = "setosa"))
# Standardize
vizdata <- visualisation_matrix(data, at = "Sepal.Length")
standardize(vizdata)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.