| rnorm_from | R Documentation |
Creates new observation of the data given its specific means and shapes. typically applied to a cluster subset of data. ie draw from cluster 'a', then assign to cluster 'b'.
rnorm_from(
data,
n_obs = 1,
var_coeff = 1,
method = c("pearson", "kendall", "spearman")
)
data |
A data.frame or matrix to sample from. |
n_obs |
Number of new observations to draw. Defaults to 1. |
var_coeff |
Variance coefficient, closer to 0 make points near the median, above 1 makes more points further away from the median. Defaults to 1. |
method |
The method of the covariance matrix. Expects "person" (continuous numeric), "kendall" or "spearman" (latter two are ranked based ordinal). |
A data.frame, sampled observations given the means and covariance of the data based on with column names kept.
Other cheem utility:
as_logical_index(),
color_scale_of(),
contains_nonnumeric(),
is_discrete(),
is_diverging(),
linear_tform(),
logistic_tform(),
problem_type(),
sug_basis(),
sug_manip_var()
library(cheem)
sub <- mtcars[mtcars$cyl == 6, ]
## Draw 3 new observations in the shape of 6 cylinder vehicles, with reduced variance.
rnorm_from(data = sub, n_obs = 3, var_coeff = .5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.