Skip to content

Instantly share code, notes, and snippets.

@sethrubenstein
Created November 9, 2022 22:12
Show Gist options
  • Select an option

  • Save sethrubenstein/907b09e5734f2524a03bac2ebb7951eb to your computer and use it in GitHub Desktop.

Select an option

Save sethrubenstein/907b09e5734f2524a03bac2ebb7951eb to your computer and use it in GitHub Desktop.

Revisions

  1. sethrubenstein revised this gist Nov 9, 2022. 1 changed file with 9 additions and 7 deletions.
    16 changes: 9 additions & 7 deletions Test-R-Thing.r
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,9 @@
    table(Apr17$party) ##
    ## Republican Democrat
    ## 375 466
    ## Independent No preference (VOL.)
    ## 616 28
    ## Other party (VOL.) Don't know/Refused (VOL.)
    ## 9 7
    q1_by_sex = svyby(~q1, #variable to estimate
    ~sex, #subgroup variable
    design = Apr17_design,
    FUN = svymean, #function to use on each subgroup
    keep.names = FALSE #does not include row.names
    #for subgroup variable
    )

    knitr::kable(q1_by_sex, digits = 2)
  2. sethrubenstein created this gist Nov 9, 2022.
    7 changes: 7 additions & 0 deletions Test-R-Thing.r
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    table(Apr17$party) ##
    ## Republican Democrat
    ## 375 466
    ## Independent No preference (VOL.)
    ## 616 28
    ## Other party (VOL.) Don't know/Refused (VOL.)
    ## 9 7