Computational Math Camp: Day 3

SURVEY

The questions (and variable types) for the Day 3 survey were: 

  1. Name (character)

  2. Email Address (unique character)

  3. What is your hometown? (character)

  4. What are your hobbies? (character)

  5. In which Ithaca neighborhood do you live? (factor)

Students completed the survey before they left on Day 2 and I compiled their responses into a CSV.

Discussion Questions

  1. How do you interpret an error message in R?

  2. What is a function?

  3. How do you construct a function in R? Note: This lesson also dedicated significant time to creating functions in R.

  4. What is an R package?

Sample Files

This lesson had two coding activities. All of these use the CSV file here:

  1. Troubleshooting: In the first activity, students went through code that wasn’t working properly and spotted the errors. The original (bad) code is here and the solutions are here.

  2. Functions: I gave students a function that I had written as an example, which can be found here and used with the CSV file and this lesson file. After that, students were asked to write their own function that would produce a list of all of the students in the class interested in “sports.” They worked in pairs and small groups and were able to come up with some great functions.

(Don’t forget to update the working directory for your machine!)

Designing the Survey for Day 4

Day 4 will focus on regressions, so the survey for Day 4 was designed to think about demand for coffee among graduate students. They were asked to consider:

  1. What are drivers of demand?

  2. What unit do you want to use to measure quantity?

  3. What are the tradeoffs between asking people for number of cups (not accurate) and number of ounces (hard to visualize)? How can you help your respondents?

  4. What prices should we use?

  5. What other factors might contribute to coffee demand? (Income)