Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- gen_start <- which(colnames(westpac)=="RespID")
- gen_end <- which(colnames(westpac)=="sc_frequency")
- for(i in gen_start:gen_end)
- {
- print(colnames(westpac[i]))
- print(table(westpac[,i]))
- }
- [1] "QI1_15"
- 0 1
- 977 393
- [1] "QI1_16"
- 0 1
- 1188 182
- library(XLConnect)
- gen_start <- which(colnames(westpac)=="RespID")
- gen_end <- which(colnames(westpac)=="sc_frequency")
- for(i in gen_start:gen_end)
- {
- tmp <- data.frame(table(westpac[,i])
- names(tmp) <- colnames(westpac[i])
- writeWorksheetToFile(file=paste0("excel", i, ".xlsx"), data=tmp, sheet="sheet1")
- }
- library(dplyr)
- dat <- westpac %>% select(RespID:sc_frequency) %>% summarise_each(funs(n()))
- writeWorksheetToFile(file="output.xlsx", data=dat, sheet="sheet1")
Add Comment
Please, Sign In to add comment