Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. HW2 <- HW %>%
  2. mutate(Hours.of.Work =
  3. fct_collapse(Hours.of.Work,
  4. "0" = "0",
  5. "1-19" = c("1-9", "10-19"),
  6. "20-39" = c("20-29", "30-34", "35-39"),
  7. "40" = "40",
  8. "41-49" = c("41-44", "45-49"),
  9. "50+" = "50+"),
  10. Hours.of.Work = factor(Hours.of.Work,
  11. levels = c("0", "1-19", "20-39", "40", "41-49", "50+")))
  12.  
  13. dput(head(HW,20))
  14. structure(list(Quarter = structure(c(49L, 49L, 49L, 49L, 49L,
  15. 49L, 49L, 49L, 49L, 49L, 48L, 48L, 48L, 48L, 48L, 48L, 48L, 48L,
  16. 48L, 48L), .Label = c("2007Q1", "2007Q2", "2007Q3", "2007Q4",
  17. "2008Q1", "2008Q2", "2008Q3", "2008Q4", "2009Q1", "2009Q2", "2009Q3",
  18. "2009Q4", "2010Q1", "2010Q2", "2010Q3", "2010Q4", "2011Q1", "2011Q2",
  19. "2011Q3", "2011Q4", "2012Q1", "2012Q2", "2012Q3", "2012Q4", "2013Q1",
  20. "2013Q2", "2013Q3", "2013Q4", "2014Q1", "2014Q2", "2014Q3", "2014Q4",
  21. "2015Q1", "2015Q2", "2015Q3", "2015Q4", "2016Q1", "2016Q2", "2016Q3",
  22. "2016Q4", "2017Q1", "2017Q2", "2017Q3", "2017Q4", "2018Q1", "2018Q2",
  23. "2018Q3", "2018Q4", "2019Q1"), class = "factor"), Hours.of.Work = structure(c(1L,
  24. 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 1L, 2L, 3L, 4L, 5L, 6L,
  25. 7L, 8L, 9L, 10L), .Label = c("0", "1-9 ", "10-19 ", "20-29 ",
  26. "30-34 ", "35-39 ", "40 ", "41-44 ", "45-49 ", "50+"), class = "factor"),
  27. Population = c(144.7, 132.7, 184.5, 244.3, 232.4, 163.1,
  28. 631.3, 94.1, 218.9, 408.3, 157.4, 129.6, 186.2, 233.6, 190,
  29. 161.7, 698.9, 85.6, 215.7, 413.4)), row.names = c(NA, 20L
  30. ), class = "data.frame")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement