Problem set 2

Due by 11:59 PM on Thursday, October 11, 2018

For this problem set, you’ll be working with data from the 2010 US Religion Census, which provides county-level data on 236 religious groups in the United States. Because this data is a little unwieldy,The original data is the epitome of untidy. Each county has its own row, and each religion gets three columns: LDSCNG for the number of congregations, LDSADH for the number of adherents, and LDSRATE for the number of adherents per 1,000 people in the county (but repeated for every religion!)

I’m giving you a pre-tidied version. Code for tidying the raw file, in case you’re interested, is available here.You should hopefully be able to understand most of the code I used.


Setting up your project

You can copy the “Problem Set 2” project on, which has this set up for you. But remember that you should eventually be moving off the cloud version and onto your computer, and this might be a good assignment to make that transition. Here are the instructions for installing everything on your computer.

  1. Create a new RStudio project named “problem-set-2” (or whatever you want to call it) and put it somewhere on your computer.

  2. Navigate to that new project folder on your computer with File Explorer (in Windows) or Finder (in macOS) (i.e. however you look at files on your computer).

  3. Download this R Markdown fileYou’ll probably need to right click on the link and select “Save link as…”

    and place it in your newly-created project (but not in your data folder—put it in the main directory):

  4. Create a new folder in your problem set folder called “data”.

  5. Download these two CSV files. They’ll probably go into your Downloads folder.You’ll probably need to right click on the link and select “Save link as…” or something similar—often browsers will load the CSV file like a web page, which isn’t helpful.

  6. Using Windows File Explorer or macOS Finder, move the newly downloaded CSV files into the “data” folder you created.

In the end, your project folder should be structured like this:Make sure your .Rmd file is not inside the data folder.

Completing the assignment

  1. Ensure that you have your new problem-set-2 project open in RStudio. Open the .Rmd file from the “Files” panel in RStudio and follow the instructions there for the rest of the problem set.

  2. There are xxxx placeholders throughout the document where you should type text.

    Feel free to delete the questions I provided and rewrite the text to be more narrative. So instead of keeping the instructions and hints, you can remove them and write things like “The top 10 religions in Utah are listed in the table below…”

  3. Knit the .Rmd as a Word documentOr PDF if you’ve installed tinytex.

    when you’re done and submit it via Learning Suite.