我有一个数据框,比如工资单,比如:
payroll <- read.table(text="
AgencyName Rate PayBasis Status NumRate
HousingAuthority $26,843.00 Annual Full-Time 26843.00
HousingAuthority $14,970.00 ProratedAnnual Part-Time 14970.00
HousingAuthority $26,843.00 Annual Full-Time 26843.00
HousingAuthority $14,970.00 ProratedAnnual Part-Time 14970.00
HousingAuthority $13.50 Hourly Part-Time 13.50
HousingAuthority $14,970.00 ProratedAnnual Part-Time 14970.00
HousingAuthority $26,843.00 Annual Full-Time 26843.00", header = TRUE)
“NumRate”实际上是数字:
payroll$NumRate <- as.numeric(payroll$NumRate)
我想通过 PayBasis 了解最高、最低和平均工资。我希望这能奏效:
ddply(payroll, "PayBasis", summarize)
但相反,我收到了一个错误:Error: length(rows) == 1 is not TRUE
我在这里想念什么?