From fee4a69906c247a2157f1932be4015d0226017c0 Mon Sep 17 00:00:00 2001 From: aaronshaw Date: Tue, 27 Oct 2020 21:33:05 -0500 Subject: [PATCH] adding proportions table (and hopefully nothing else) --- psets/pset5-worked_solution.html | 8 +++++++- psets/pset5-worked_solution.rmd | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/psets/pset5-worked_solution.html b/psets/pset5-worked_solution.html index 4378477..4bb5504 100644 --- a/psets/pset5-worked_solution.html +++ b/psets/pset5-worked_solution.html @@ -1617,6 +1617,12 @@ obama.tbl ## took_fruit FALSE TRUE ## FALSE 593 322 ## TRUE 185 122 +
obama.prop.tbl <- proportions(table(took_fruit = df$fruit, saw_flotus = df$obama), margin = 2)
+obama.prop.tbl
+
##           saw_flotus
+## took_fruit     FALSE      TRUE
+##      FALSE 0.7622108 0.7252252
+##      TRUE  0.2377892 0.2747748

PC4. Test for differences between groups

@@ -1736,7 +1742,7 @@ p1
library(xtable)
 print(xtable(obama.tbl), type = "html")
## <!-- html table generated in R 4.0.3 by xtable 1.8-4 package -->
-## <!-- Mon Oct 26 11:16:05 2020 -->
+## <!-- Tue Oct 27 20:25:44 2020 -->
 ## <table border=1>
 ## <tr> <th>  </th> <th> FALSE </th> <th> TRUE </th>  </tr>
 ##   <tr> <td align="right"> FALSE </td> <td align="right"> 593 </td> <td align="right"> 322 </td> </tr>
diff --git a/psets/pset5-worked_solution.rmd b/psets/pset5-worked_solution.rmd
index 32ced5c..f2c8991 100644
--- a/psets/pset5-worked_solution.rmd
+++ b/psets/pset5-worked_solution.rmd
@@ -70,6 +70,8 @@ summary(df)
 obama.tbl <- table(took_fruit=df$fruit, saw_flotus=df$obama)
 obama.tbl
 
+obama.prop.tbl <- proportions(table(took_fruit=df$fruit, saw_flotus=df$obama), margin=2)
+obama.prop.tbl
 ```
 
 ## PC4. Test for differences between groups
-- 
2.39.5