Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. T4 <- table(bank$Term_deposit, bank$housing_loan)
  2. %>% prop.table(margin = 2) *100
  3.  
  4. T4
  5.  
  6. no yes
  7. no 83.418772 92.217126 <br/>
  8. yes 16.581228 7.782874
  9.  
  10. kable(T4, caption = "%agewise comparison for marital status")
  11.  
  12. | | no| yes|<br/>
  13. |:---|--------:|---------:|<br/>
  14. |no | 83.41877| 92.217126|<br/>
  15. |yes | 16.58123| 7.782874|<br/>
  16.  
  17. | | no| yes|<br/>
  18. |:---|--------:|---------:|<br/>
  19. CAT1 | 83.41877| 92.217126|<br/>
  20. |CAT2| 16.58123| 7.782874|
  21.  
  22. | | cat1| cat2|<br/>
  23. |:---|--------:|---------:|<br/>
  24. CAT1 | 83.41877| 92.217126|<br/>
  25. |CAT2| 16.58123| 7.782874|<br/>
  26.  
  27. library(pandoc)
  28.  
  29. colnames(T4) <- c("CAT1", "CAT2")
  30. rownames(T4) <- c("no", "yes")
  31. pandoc.table(T4)
  32.  
  33. -------------------------
  34. &nbsp; CAT1 CAT2
  35. -------- -------- -------
  36. **y** 13473 77311
  37.  
  38. **n** 226221 0
  39. -------------------------
  40.  
  41. colnames(T4) <- c("deposit: no", "deposit: yes")
  42. rownames(T4) <- c("loan: no", "loan: yes")
  43. pandoc.table(T4)
  44.  
  45. --------------------------------------------
  46. &nbsp; deposit: no deposit: yes
  47. --------------- ------------- --------------
  48. **loan: no** 13473 77311
  49.  
  50. **loan: yes** 226221 0
  51. --------------------------------------------
  52.  
  53. library(expss)
  54.  
  55. df <- apply_labels(bank,
  56. Term_deposit= "Term deposit",
  57. housing_loan= "Housing loan")
  58.  
  59. cro_cpct(bank$Term_deposit, bank$housing_loan)
  60.  
  61. | | | Housing loan | |
  62. | | | 0 | 1 |
  63. | ------------ | ------------ | ------------ | --- |
  64. | Term deposit | 0 | 39.4 | 100 |
  65. | | 1 | 60.6 | |
  66. | | #Total cases | 66.0 | 34 |
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement