Skip to content
R for the Rest of Us Logo

R in 3 Months (Spring 2025)

Week 2 Project Assignment

Transcript

Click on the transcript to go to that point in the video. Please note that transcripts are auto generated and may contain minor inaccuracies.

Assignment example:

Your Turn

Before you do anything else, please check in with your coach and confirm that the data you are using is a good fit for the first few weeks of R in 3 Months. If you need some generic data, we have created a repository with several simple datasets for you to work with.

For this week, we want you to do some wrangling and analysis of your data. You can see an example in the "View code shown in video" section above. To do this assignment, you'll do the following:

1. Create a directory called “project_assignment” and create a new R project in this existing directory. Then create subfolders following our recommendation in this lesson. Alternatively, download the learner directory template which contains the project_assignment folder, and create an R project in it.

project_assignment/
    ├── code/
    ├── data-raw/
    ├── data/
    └── project_assignment.Rproj

2. Chose a dataset (one of your own datasets or one of our suggested datasets) and store it in the data-raw folder.

3. Create an R script file, save it to the code folder, and add three sections (use ctrl + shift + R to open the section box):

# Load packages ---

# Import data ---

# Questions about the data ---

4. Under the “load packages” section you will load your packages

5. Under the “Import data” section, write the correct code to import your data as a CSV (if your data is in another format, let us know and we can help you convert it). Notice that you will need to specify the file path starting with “data-raw”.

6. Take some time to explore your dataset as we did in this lesson. No need to save your code in your script at this stage, but if you want to, add a comment or a new section for it. We recommend using pen and paper to take notes.

7. Under the “Questions about the data” section, add, as comments, exactly three questions that you want to answer with your data.

8. Under each question, create the correct code to answer it.

9. Once you've completed your work, compress your project_assignment folder and upload it to the form below.

10. If you have any specific questions, add those in the form below as well, or as comments in your R script. You can also record a video using the button below to send me a video demonstrating a bug, or explaining in more details what you were trying to do.

Have any questions? Put them below and we will help you out!

You need to be signed-in to comment on this post. Login.

Maria Athayde

Maria Athayde • September 23, 2024

Will we get notified when we submit the assignment? I submitted my assignment, but when I refresh this page, it asks me to submit it again.

Gracielle Higino

Gracielle Higino Coach • September 23, 2024

Hi Maria! You probably won't get notified, but you can always DM me on Discord to check! =D I just checked here and your assignment was submitted - and it looks great, by the way! Can't wait to dig into it!

Raouf Kilada

Raouf Kilada • October 23, 2024

Hey Gracielle, In your example you used artist_ethinticity to show white...while it is artist_race why did you use ethinicity and not race?

Gracielle Higino

Gracielle Higino Coach • October 23, 2024

Good catch, Raouf! That was an error on my side - on purpose or not 😉. Notice that R didn't have a problem with that because I was asking it to filter out only the rows with the string "White" in the column "artist_ethnicity", and so it returns all the rows on the dataset because this combination doesn't exist.

Raouf Kilada

Raouf Kilada • October 24, 2024

Thanks Gracielle, This is interesting because when I used race, I did not get the expected results...While When I used artist_ethinticity, I gor it.....

Gracielle Higino

Gracielle Higino Coach • October 25, 2024

That's because when you filter by "race", you actually get rows excluded since this is the correct variable to filter by. There are rows with the value "White" in it. 😊 If you use "ethnicity" instead, R is not going to filter any rows as it won't find any values "White" in this column, and the results will be similar to mine.

But this is only an assignment demonstration, it's not supposed to be correct code - I'm simulating someone who's learning R 😁

Dottington Fullwood

Dottington Fullwood • March 17, 2025

Unsure if my revised zip was uploaded.

Gracielle Higino

Gracielle Higino Coach • March 17, 2025

Hi Dottington! We got it, don't worry!

Hajira Koeller

Hajira Koeller • March 19, 2025

Hi Gracielle, My data is in Excel and I want to practice importing data in that file format, as well as cleaning up delimited data. Will that work?

Gracielle Higino

Gracielle Higino Coach • March 20, 2025

Hi Hajira! The reason why we prefer to convert data from other formats to CSV is that CSV files are interoperable and have less problems than Excel files. However, once you successfully read them into an R session, everything else being equal, the operations to clean and tidy the data will be the same. We'll cover Excel files in the advanced lessons, but try using the {readxl} package to read your data in, like this:

read_excel(datasets)

Course Content

127 Lessons