Skip to content

Unit 3 Lab Code

Unit 3 Lab Ojectives and Functions:

The documentation below lists the new functions that will appear in each lab. The lab itself will explain how to use each function. For more examples, refer to the RStudio Lab Codes and Functions file.

Lab3A

  • Objective: Students will investigate the question: Does the stimulus your class chose change people’s perception of time? and analyze their experimental data using plots, numerical summaries, and shuffling.
    No new functions
    

Lab3B

  • Objective: Students will understand the difference between experiments and observational studies and investigate the question: What is the effect of childhood smoking on lung health?
    No new functions
    

Lab3C

  • Objective: Students will understand the difference between population data and sample data and learn how sampling methods affect how representative a sample is of a population.
    slice(x, from:to)
    

Lab3D

  • Objective: Students will learn how to calculate margins of error using the bootstrap and investigate the question: What is the mean age of people older than 15 living in the United States?
    No new functions
    

Lab3E

  • Objective: Students will learn how to scrape data by gathering information from the web and cleaning it.
    readHTMLTable(url, which)
    length(x)
    

Lab3F

  • Objective: Students will learn how to to create an interactive map of the mountains data scraped in lab 3e.
    load(file)
    leaflet()
    addTiles()
    addMarkers(map, lng, lat, popup)
    colorize()
    addCircleMarkers()
    addLegend(x, colors, labels)