umx_scale | R Documentation |
umx_scale
applies scale()
to the columns of a data.frame. By default it scales all numeric columns,
and is smart enough to skip non-scalable columns (strings, factors, etc.).
You can also select which columns to convert. This is useful when you want to avoid numeric columns which are actually factors.
note: By default, the scale()
function adds attributes()
("scaled:center" and
"scaled:scale", umx_scale
removes these leaving nice numeric columns. Set attr= TRUE
to preserve them.
umx_scale(
df,
varsToScale = NULL,
coerce = FALSE,
attr = FALSE,
verbose = FALSE
)
df |
A dataframe to scale (or a numeric vector) |
varsToScale |
(leave blank to scale all) |
coerce |
Whether to coerce non-numerics to numeric (Defaults to FALSE. |
attr |
to strip off the attributes scale creates (FALSE by default) |
verbose |
Whether to report which columns were scaled (default FALSE) |
new dataframe with scaled variables
umx_scale_wide_twin_data scale
Other Miscellaneous Stats Functions:
FishersMethod()
,
SE_from_p()
,
geometric_mean()
,
harmonic_mean()
,
oddsratio()
,
reliability()
,
umx
,
umxCov2cor()
,
umxHetCor()
,
umxParan()
,
umxWeightedAIC()
,
umx_apply()
,
umx_cor()
,
umx_means()
,
umx_r_test()
,
umx_round()
,
umx_var()
data(twinData)
# note: this example is here to remind us why scaling independently for each
# twin would be very bad! Use umx_scale_wide_twin_data() instead!
df = umx_scale(twinData, varsToScale = c("wt1", "wt2"))
df = umx_scale(twinData, attr= TRUE)
plot(wt1 ~ wt2, data = df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.