Description Usage Arguments Value Examples
Take the mean of a variable for all rows with the same id except for the current row, so as to avoid leakage.
1 | loo_encode(id, resp)
|
id |
vector of identifiers to group over |
resp |
vector of response to summarise |
vector of one-left-out summarised response over id
1 2 3 4 5 6 | test_data <- data.frame(
id = c(rep("a", 5), rep("b", 3), rep("c", 2), "d"),
resp = c(1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1)
)
loo_encode(test_data$id, test_data$resp)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.