Soci–269
Coding Assignment in

  Deadline

Wednesday, November 5th at 8:00 PM

Basic Expectations

As noted in your syllabus, you are required to submit a coding assignment by Wednesday, November 5th at 8:00 PM. For this assignment, you will clean a dataset in , report basic descriptive statistics, create simple data visualizations, and provide some substantive interpretations. You must also include your script file (e.g., a .R or .Rmd document) as part of your submission. Once you’re done, please submit your materials via Moodle.

You Must Submit Two Separate Files

Please remember to submit (i) the code you used to complete the assignment along with (ii) a text-based summary of your results and interpretations.

The Data

Description

You will be working with a truncated version of the 2010 General Social Survey (henceforth, GSS). The dataset was prepared using the {gssr} package in .

You can access the data through one of three channels:

  1. By copying and pasting the script below directly into RStudio:
readRDS(url("https://github.com/sakeefkarim/soci-269-f25/raw/refs/heads/main/data/assignments/coding%20assignment%201/gss_2010_truncated.rds"))
  1. By directly downloading the .rds file.

  2. By cloning our companion GitHub repository.

Variables

Learn more about the variables in your data by using the interactive table embedded below. This table includes data on all variables with labels in the broader (i.e., non-coarsened) 2010 GSS.

Coding Tasks

  1. Report the mean for all numeric variables in the data—with and without weights.1

You may want to explore the weighted.mean() function.

  1. Report the median age of all respondents by race and sex. Concretely, your estimates should provide the median age of Black women, “Other” men etc. These results do not have to be weighted. That said, if you want to generate weighted medians, feel free to explore the Hmisc::wtd.quantile() function.

  2. Report the percentage share of respondents who are Democrats—including Independents who lean Democrat and those who do not consider themselves “strong” Democrats. Once again, these results do not have to be weighted.2

Summarizing Descriptive Results

When writing up your results for Questions 1-3, please use simple tables and plots to present your results in lieu of detailed narrative exposition.

  1. Explore the hrsrelax, mntlhlth and physhlth variables. What do they refer to? Are they meaningfully patterned by age, race, religion, sex, sexuality and their many intersections? Using ggplot2, generate two simple visualizations that provide preliminary insights based on your exploratory assessments and hunches.

You may want to use facet_wrap() or facet_grid() to simplify your story.

  1. Respond to one of the following prompts:

    • What does the letin1a variable capture? Generate a simple (but elegant) visualization using ggplot2 that illustrates how letin1a may be socially patterned.

    • Using 2018-2022 ACS (American Community Survey) data, produce a map of Boston that speaks to the racial diversity of the city.

Narrative Interpretation

Pick any one of your plots from Questions 4-5. Then, drawing on relevant social scientific research,3 carefully interpret the results. Clearly articulate how your findings relate to (i.e., refine or complicate) extant understandings of \(x\), your social phenomenon of interest. Do your results offer novel or interesting insights? Are there any unexpected patterns that emerge, and if so, how can you account for them? Thoughtfully connect your interpretation to existing work, highlighting areas of convergence or disjuncture before clarifying what your graphic reveals about the social mechanisms animating \(x\). Remember, you have to be brief: papers must be between 5 and 10 pages.

Formatting Guidelines

You are free to prepare your first assignment in Microsoft Word, Google Docs, \(\LaTeX\), RMarkdown or Quarto. Concretely, this means you can submit your assignment as a .docx file or as a . Your main text must be double-spaced and formatted in a 12-point font. Margins should be set to 1 inch on all sides (top, bottom, left, and right). You are free to use either an APA or ASA citation style to manage the references you include.

If you haven’t done so already, you may want to invest in Zotero to manage your citations.

A Note About Subheadings

You must use subheadings to organize your arguments.

Footnotes

  1. You do not need to provide means for the weighting variable.↩︎

  2. You are, however, free to produce weighted estimates.↩︎

  3. Most of the papers you engage with should be quantitatively oriented.↩︎