HW04: Tidying data & programming in R

Overview

Due Thursday, November 7th (11:59 PM).

The past couple of weeks we learned tidyr principles to wrangle data, and we started learning key programming concepts in R.

The goals of this homework assignment are two: (1) practice tidy data concepts, and (2) demonstrate competency in R programming skills, especially data structures and control structures (e.g., conditional statements and loops).

Accessing and cloning your hw04 repository

  • Go at this link to accept the invitation and create your private hw04 repository on GitHub. Once you do so, your repo will be built in a few seconds. It follows the naming convention hw04-<USERNAME>
  • Once your repository has been created, click on the provided link to access it.
  • Finally, follow the same steps you completed for hw01 to clone the repository to your R Workbench.

General workflow

See Homework 1 for details.

Assignment description

This homework assignment consists of two parts:

  • Part 1: practicing tidying data with tidyr
  • Part 2: practicing programming in R by applying the programming techniques we have learned so far

In the repo for this assignment you will find a .Rmd file with the questions for each part.

For part 1, your main task is to tidy a data frame called dadmom, which is in the rcis package. The final tidy product should look like this:

famidparentnameinc
1dBill30000
1mBess15000
2dArt22000
2mAmy18000
3dPaul25000
3mPat50000

Please note:

  • The questions, especially the open-ended ones, are designed to help you think and plan before diving into coding, similar to challenges you might face in real-world research settings. They won’t lay out exact step-by-step instructions, as they encourage you to apply and expand on the code you’ve learned so far. One of the main goals of this assignment (and future ones) is for you to tackle these challenges independently. We know you can do it!
  • All assignments are designed to be completed in multiple coding sessions. Start early, and save, stage, commit, and push often!
  • You are not allowed to use AI tools to generate R code to complete this and future assignments. The only acceptable uses of AI tools are the following two: debugging (but only after you have made an attempt on your own) and generating examples of how to use a specific function (but also check the function documentation, and the course materials – if there are many ways to code something, you are expected prioritize what we have learned vs. what we have not). While AI tools can be helpful outside of class, this is a coding course, and it’s all about learning to code in R, not learning to use AI!
  • Do not submit code that you cannot fully explain to yourself and someone else.

Refer to HW2 guidelines for formatting tables and graphs. Ensure you follow proper R coding style and make appropriate use of comments in your code (refer to the readings and lecture on this topic).

Submit the assignment

To submit the assignment, follow these steps:

  • First push to your repository the last version of your assignment before the deadline. Make sure to stage-commit-push the following files:

    • programming.Rmd: the main file you will add your code to
    • programming.md: you will generate this file from the .Rmd by knitting it
  • When you are ready to submit, copy your repository URL (e.g. https://github.com/css-fall24/hw4-brinasab) and submit it on Canvas under HW04 before the deadline. Do not submit files on Canvas, we only need the link to your repository

  • As part of your submission, at the end of the .Rmd for this homework, include a few reflections on your experience with this assignment, list any help you might have received (from both humans and AI), as specified in the instructions.

Assessment

All homework assignments are evaluated using a rubric which you can access from the assignment submission folder on Canvas. See also here for more.

Further guidelines for this specific homework to help you assess your work before submitting it.

In the past, “Excellent” or “Very Good” work included submissions that completed all components of the assignment correctly and accurately. Code ran correctly, followed proper style, and was well-documented without excessive comments. The code and answers demonstrated strong grasp of class materials and were aligned with the prompt and course material, demonstrating a nuanced understanding of concepts and using them effectively throughout the assignment. There was a solid command of basic R programming and required packages. Additionally, the repository showed a history of multiple informative commits, reflecting the progression and backup of work. Command of R Markdown syntax was evident, with no errors.

Acknowledgments

The initial version of this homework was developed by Benjamin Soltoff (“Computing for the Social Sciences” licensed under the CC BY-NC 4.0 Creative Commons License). Further implementations have been developed by Sabrina Nardin.

Previous
Next