exemplar | R Documentation |
Construct a single "exemplar" record from a data frame. For now, all numeric
columns (including "Date"
objects) are replaced with their
corresponding median value and non-numeric columns are replaced with their
most frequent value.
exemplar(object) ## S3 method for class 'data.frame' exemplar(object) ## S3 method for class 'matrix' exemplar(object) ## S3 method for class 'dgCMatrix' exemplar(object)
object |
A data frame, matrix, or
|
A data frame with the same number of columns as object
and a
single row.
set.seed(1554) # for reproducibility train <- data.frame( x = rnorm(100), y = sample(letters[1L:3L], size = 100, replace = TRUE, prob = c(0.1, 0.1, 0.8)) ) exemplar(train)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.