I would like to ask for your advice on how to add mean_center = True
to the following code:
library(dplyr)
dataset <- dataset %>%
mutate_at(.vars = colnames(dataset[5:10]),
.funs = list("c" = center_scale))
mean_center
is an argument of center_scale
For example, a sample data is:
structure(list(ï..x1 = c(2.6, 3.8, 2.6, 4.3, 2.6, 4.4, 4.4, 2.6,
2.6, 2.6), x2 = c(3.2, 3.2, 3.2, 4, 3.2, 2.2, 2.2, 3.2, 3.2,
3.2), x3 = c(4.5, 3.5, 4.5, 3, 4.5, 4, 4, 4.5, 4.5, 4.5), x4 = c(2.4,
3, 2.4, 3.1, 2.4, 4.3, 4.3, 2.4, 2.4, 2.4), x5 = c(3.8, 2.6,
4.3, 2.6, 4.4, 2.6, 4.3, 3.4, 3.4, 3.4), x6 = c(3.2, 3.2, 4,
3.2, 2.2, 3.2, 2.6, 2.8, 3.9, 1.3), x7 = c(3.5, 4.5, 3, 4.5,
4, 4.5, 2.9, 3.7, 3.5, 4.8), x8 = c(3, 2.4, 3.1, 2.4, 4.3, 2.4,
4.1, 3, 3.4, 2.7), x9 = c(3.9, 4, 4, 4, 3.9, 4, 3.5, 4.1, 4.3,
3.7), x10 = c(4, 3.9, 4, 4, 4, 3.9, 3.9, 4, 4, 4)), class = "data.frame", row.names = c(NA,
-10L))