Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. '''r
  2. attendance_summary <- function(ReasonName, FUN = sum) {
  3. tapply(AttendanceTab[, ReasonName],
  4. AttendanceTab[,1:2], sum)
  5. }
  6. '''
  7.  
  8. '''r
  9. attendance_summary("Advising")
  10. attendance_summary("Hang.Out")
  11. attendance_summary("Food")
  12. attendance_summary("Printing")
  13. attendance_summary("Supplies")
  14. attendance_summary("Studying")
  15. attendance_summary("Lending.Library")
  16. attendance_summary("Other")
  17. '''
  18.  
  19. '''r
  20. Complexes <- dim(AttendanceTab)[2]
  21. reasons <- as.character(c("Advising", "Hang Out", "Food",
  22. "Printing", "Supplies", "Studying", "Lending Library",
  23. "Other"))
  24. '''
  25.  
  26. '''r
  27. for(i in 1:Complexes) {
  28. RR <- reasons[[i]]
  29. ADSum <- attendance_summary(RR)
  30. print(ADSum)
  31. }
  32. '''
  33. '''r
  34. sapply(AttendanceTab, attendance_summary)
  35. Also tried
  36. sapply(reasons, attendance_summary)
  37. '''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement