-1
我想彙總這個數據框,其中每個Family Size
有六個類別,Hours Worked
。所有的多個條件下的聚合列
families <- structure(list(`Family Size` = c(2L, 2L, 2L, 2L, 2L, 2L, 2L,13L, 13L, 13L), HoursLess20 = c("1,014", "1,041", "11", "3","1", "2", "1", "0", "0", "0"), Hours2024 = c(7L, 298L, 1L, 0L,0L, 0L, 0L, 0L, 0L, 0L), Hours2529 = c(1L, 34L, 0L, 0L, 0L, 0L,0L, 0L, 0L, 0L), Hours3034 = c(6L, 44L, 1L, 0L, 0L, 0L, 0L, 0L,0L, 0L), Hours3539 = c(4L, 46L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), Hours40plus = c(9L, 128L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L)), .Names = c("Family Size","HoursLess20", "Hours2024", "Hours2529", "Hours3034", "Hours3539","Hours40plus"), row.names = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 1977L,1978L, 1979L), class = "data.frame")
你想如何聚合?總和?平均? – G5W