Welcome!

This section focuses on the pedagogy used to design and implement this course. The information provided here is predominantly for collaborations with fellow instructors and students are not expected to read through here (but you are more than welcome to if you are curious).


Learning Objectives

There are 5 course modules: R Basics, Working with Data, Plotting Data, Data Manipulation, and Functions. The following sections were created following the Understanding by Design (i.e., Backwards Design) framework developed by Wiggins and McTighe.


Module 1: R Basics


Desired results


Established goals

Upon completion of this module (and beyond), students will understand the following big ideas:

  • The R programming language is used for statistics, data analysis, and data visualization.

  • Open science and reproducible research improve the reliability and efficiency of scientific research.

  • Improving reliability and efficiency in our research increases the credibility of published scientific literature and accelerates discovery.


Transfer

Students will be able to independently use their learning to…

  • implement principles of open science and reproducibility when designing their own research projects.

  • use R and RStudio as the basis for manipulating, analyzing, and visualizing their data.

  • use R and RStudio to explore analyses and data visualizations created by other scientists (e.g., to critically review, collaborate with, or build upon their research).


Meaning

## Warning: package 'captioner' was built under R version 4.2.1
Students will understand… Essential Questions
the mission of open science. Example related to open science
the history of R.
the role R plays in reproducible science.


Acquisition

Students will know how to… Students will be skilled at…
define what R is. creating an R script.
define what RStudio is. setting the working directory in RStudio.
define an object in R. creating a project in RStudio.
define data types of R objects. finding the help file(s) for a function or package.
define a vector. using #comments to annotate R scripts.
assigning an object a value.
printing an object value to the R Console.
finding the data type of an object.
creating a vector.


Module 2: Working with Data


Desired results


Established goals

Upon completion of this module (and beyond), students will understand the following big ideas:

  • R is a well-supported framework for data exploration.

  • Data collection can produce data structures that need to be rearranged for statistical analyses.

  • Understanding the data types and structures used in R is helpful for troubleshooting error messages.


Transfer

Students will be able to independently use their learning to…

  • plan their data collection scheme to match the format required for the intended statistical analysis

  • critically evaluate documentation and data sets collected by other scientists

  • diagnose programming errors that are related to R-specific data types and structures


Meaning

Students will understand… Essential Questions
that data formats vary & may need to be changed for analysis. How does R help me explore data?
the intended purpose of each data type and structure.
that data types and structures are key to solving programming errors.


Acquisition

Students will know how to… Students will be skilled at…
define a data frame. reading in a data file into RStudio.
define a matrix. creating an array.
define an array. creating a matrix.
define a list. creating a list.
define a factor. creating a data frame.
creating a factor.
finding the dimensions of a data structure.
subsetting a vector.
using Boolean operators.
subsetting a vector using Boolean operators.
extracting column names from a data frame.
extracting columns of a data frame by name.
extracting columns of a data frame by indices.
extracting columns of a data frame using Boolean operators.
removing NA from objects (e.g., data frame, matrix, or list).
extracting elements from a list.
replacing elements in an object (e.g., data frame, matrix, or list).

Module 3: Plotting Data


Desired results


Established goals

Upon completion of this module (and beyond), students will understand the following big ideas:

  • R provides a toolkit for quickly visualizing data before analysis.

  • R users can produce high quality figures for publications, reports, etc.


Transfer

Students will be able to independently use their learning to…

  • quickly produce exploratory plots of new data sets.

  • create multi-panel figures.

  • customize legends, plot axes, and plot types.


Meaning

Students will understand… Essential Questions
the first step of data exploration is to plot your data. How does R help me visualize data?
that using ?par is a best practice of plotting in base R.


Acquisition

Students will know how to… Students will be skilled at…
define and navigate the par() function. using the x and y arguments of plot() to create a plot.
define and navigate the plot() function. labeling the x- and y-axes and title.
defining the x- and y-limits.
removing the space around zero on the x- and y- axes.
changing the color of points, lines, text, etc..
changing the point characteristics (pch) or line type (lty).
changing the character expansion (cex) or line width (lwd) of data.
adding an accurate legend.
suppressing the axes inside the call to plot().
creating custom axes for a plot (e.g, axis(), xaxp and yaxp arguments in plot().
adding text to the inside of a plot.
changing the type of plot (e.g., points, lines, etc).
adding additional lines() or points() to an existing plot.
using par(mfrow) or par(mfcol) to create a multi-panel plot.
using par(mar) or par(oma) to manipulate the margins of a multi-panel plot.
using mtext() to add text to the outside of a plot.
using layout() to creat a multi-panel plot.
creating a boxplot.
creating a barplot.
saving plots as a pdf().

Module 4: Data Manipulation


Desired results


Established goals

Upon completion of this module (and beyond), students will understand the following big ideas:

  • R is a well-supported framework for data cleaning.

  • Data types and structures dictate the way data can be subset and analyzed.

  • R has helpful features for working with date and time data.


Transfer

Students will be able to independently use their learning to…

  • subset large data sets for future data exploration and research projects.

  • combine multiple data sets for future data exploration and research projects.

  • perform repetitive arithmetic functions on matrices.


Meaning

Students will understand… Essential Questions
there are multiple ways to subset data structures. How does R help me manipulate data for visualization or analysis?
the appropriate scenarios for using an element’s index vs. value.
the apply() family of functions can simplify reptitive calculations.


Acquisition

Students will know how to… Students will be skilled at…
define an R package. finding the unique elements in an object.
define an R library. finding the duplicated elements in an object.
define a Date or POSIXt class. using subset() to subset an object.
look up built in constants in R. using apply() to use an arithmetic function on a matrix.
describe unique() vs. duplicated(). using tapply() to use an arithmetic function on a matrix using a categorical variable.
describe sort() vs. order(). applying sort() and order() to objects.
look up the apply() family of functions. using system.time() to calculate how long it takes to run a command.
combining two objects using merge().
assigning an object a Date or POSIXtclass.
extracting components of dates.
applying arithmetic functions to objects of Date class.
installing a package in RStudio.
loading a package in RStudio.


Module 5: Functions


Desired results


Established goals

Upon completion of this module (and beyond), students will understand the following big ideas:

  • A function is a set of statements organized together to perform a specific task.

  • R has a large number of built-in functions and has access to a large supply of open source and community-created functions.

  • R users can write their own functions to re-use for multiple analyses.


Transfer

Students will be able to independently use their learning to…

  • critically evaluate the performance of functions found in packages created by other users.

  • write the own functions to re-use in future analyses.

  • use the output of functions to summarize the results of statistical analyses.


Meaning

Students will understand… Essential Questions
how to determine if a function’s arguments require a specific data type or structure. How do I use and write functions in R?
how to write their own function and save its output.
the difference between the local environment of a function and the global environment of R.


Acquisition

Students will know how to… Students will be skilled at…
describe the difference between local and global objects (i.e., scope). specifying the arguments required for a function.
identify the different parts of a function. return()ing an object local to a function for use in the global environment.
using a list to return multiple objects local to a function for use in the global environment.
writing objects to a file (e.g., .csv).


Evidence and Assessment


Knowledge

  • Pre- and post-course assessment (Established Goals/Big Ideas for each module)
  • Post-lecture (video) quizzes
  • swirl assignments

Comprehension

  • Beginning of class Poll Everywhere Warm-Up questions

Application

  • In-class coding exercises (i.e., labs)

Analysis

  • In-class discussions (Think-Pair-Shares; Gallery Walks; Jigsaws)

Synthesis

  • Homework assignments

Evaluation

  • TBA; perhaps a homework assignment or in-class presentation

Self-assessment/Student reflections

  • 1 minute write at the end of each class
  • self-grading on in-class assignments

Lesson plans

TBA


References


This site was last updated at 15:13 on 14 Jul 2022