Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''r
- attendance_summary <- function(ReasonName, FUN = sum) {
- tapply(AttendanceTab[, ReasonName],
- AttendanceTab[,1:2], sum)
- }
- '''
- '''r
- attendance_summary("Advising")
- attendance_summary("Hang.Out")
- attendance_summary("Food")
- attendance_summary("Printing")
- attendance_summary("Supplies")
- attendance_summary("Studying")
- attendance_summary("Lending.Library")
- attendance_summary("Other")
- '''
- '''r
- Complexes <- dim(AttendanceTab)[2]
- reasons <- as.character(c("Advising", "Hang Out", "Food",
- "Printing", "Supplies", "Studying", "Lending Library",
- "Other"))
- '''
- '''r
- for(i in 1:Complexes) {
- RR <- reasons[[i]]
- ADSum <- attendance_summary(RR)
- print(ADSum)
- }
- '''
- '''r
- sapply(AttendanceTab, attendance_summary)
- Also tried
- sapply(reasons, attendance_summary)
- '''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement