我经常在 library(car) 中使用 'recode' 函数来重新编码变量中的级别。直到今天,我的代码都运行良好,但现在却出现了错误。df 等没有任何变化,不确定发生了什么。
可能有人可以启发我!
我的数据框(样本):
test<-structure(list(Avg.Salary = c("65000", "395", "82000", "128357",
"95785", "95785"), Education = c("Doctorate", "Professional Degree",
"Bachelor's", "Professional Degree", "Master's", "Master's"),
Count = c("D", "D", "D", "D", "D", "364584"), Year = c(2017,
2017, 2017, 2017, 2017, 2017)), row.names = c("540061", "540071",
"540081", "540091", "540102", "540112"), class = "data.frame")
Run Code Online (Sandbox Code Playgroud)
我的实际数据集中的级别:-
Associate Degree Associates Bachelor's
205 35 42446
D Doctorate High School
42902 9846 191
Master's Missing Education No Diploma
57644 218 79
Professional Professional …Run Code Online (Sandbox Code Playgroud)