# NOT RUN {
library(metan)
library(dplyr)
# Rescale a numeric vector
resca(values = c(1:5))
# Using a data frame
head(
resca(data_ge, GY, HM, new_min = 0, new_max = 1)
)
# Rescale within factors;
# Select variables that stats with 'N' and ends with 'L';
# Compute the mean of these variables by ENV and GEN;
# Rescale the variables that ends with 'L' whithin ENV;
data_ge2 %>%
select(ENV, GEN, starts_with("N"), ends_with("L")) %>%
group_by(ENV, GEN) %>%
summarise_all(mean) %>%
group_by(ENV) %>%
resca(ends_with("L")) %>%
head(n = 13)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab