generate_X_rwd | R Documentation |
Generate a design matrix X by sampling from a real-world data matrix under the specified sampling scheme.
generate_X_rwd(X, n = nrow(X), p = ncol(X), clusters = NULL, replace = FALSE)
X |
Data matrix or data frame. |
n |
Number of samples if |
p |
Number of features. If |
clusters |
(Optional) Vector of cluster IDs. If provided, block or clustered sampling will be performed according to these clusters so that each cluster will be entirely in or entirely out of the retrieved sample. |
replace |
Logical. If TRUE, sample observations with replacement; if FALSE, sample observations without replacement |
A matrix of size n x p.
# get bootstrap samples from iris data set X <- generate_X_rwd(X = iris, replace = TRUE) # leave one batch out from iris data set batch_ids <- rep(1:3, length.out = nrow(iris)) X <- generate_X_rwd(X = iris, n = 2, clusters = batch_ids)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.