Data Science Hour of Code
Activity 4: Selecting a FactorScenario:
- You're a data scientist working with a group of researchers from Antarctica.
 - They have collected a bunch of data about penguins, but need help answering questions about it.
 - Your job is to make some charts from the data and answer some of their questions.
 
Introduction:
You may have noticed in our Penguins2.csv dataset, some of the columns have values that are numbers (bill_length, bill_depth, flipper_length) and some have values that are text (species, island). Let's say we wanted to look at the relationship between bill_depth and bill_length, like we did in Activity 1, but we also want to break that data down into smaller groups based a Factor like species. This would show us three comparisons of bill_depth versus bill_length for the Adelie, Gentoo and Chinstrap penguins.
| species | island | bill_depth | bill_length | flipper_length | 
|---|---|---|---|---|
| Adelie | Torgersen | 18.7 | 39.1 | 181 | 
| Adelie | Biscoe | 18.3 | 37.8 | 174 | 
| Adelie | Dream | 18.5 | 36.8 | 193 | 
| Gentoo | Biscoe | 13.2 | 46.1 | 211 | 
| Chinstrap | Dream | 17.9 | 46.5 | 192 | 
Instructions:
In the code editor below, we have a program that makes a Chart looking at Bill Depth vs Bill Length. Take code blocks from the palette and place them below where we Load the .csv, but before we make the Chart object.
- Use the block(s) in the palette on the left.
 - Place the 'frame:AddSelectedFactors("species")' block below the 'frame:Load("data/Penguins2.csv")' block in the block editor.
 - Run the program.
 - Use the chart in the canvas to answer the questions in the Activity section.
 
Coding:
Blocks
Activity:
Use the chart(s) you've created in the Coding section to answer a few questions.
Next Tutorial
In the next tutorial, we will discuss Customizing the Colors, which describes how to customize the colors in the Chart..