Когда я печатаю b, он не печатает с правильными значениями, любая помощь будет оценена.
df <- data.frame(
"Values" = c("Gender","Gender","Marital Status","Marital Status","Age","Age"),
"Mean"= c(0.6934877, 0.8536885, 0.8801737, 0.8998975, 54.6858177, 54.1486680),
"By"= c("Urban", "Rural", "Urban","Rural","Urban", "Rural")
)
a <- as.data.frame(df %>%
spread(By, Mean)%>%
dplyr::group_by(Values))
a[2]
b <- a %>%
dplyr::mutate(Max = max(a[2], a[3]),
Min = min(a[2], a[3]),
Diff = Max / Min - 1) %>%
dplyr::arrange(desc(Diff)) %>%
dplyr::filter(Diff > .2)
b