/r4bs

R for Behavioral Science. Materials for 2018 SBM seminar.

r4bs

R for Behavioral Science. Materials for 2018 SBM workshop.

April 11, 8:

Abstract

Behavioral science has been keen to use technology for data capture (e.g., social media, smartphones, and wearable devices) as well as integrate multiple streams of data to measure exposures and outcomes. However, as a whole, the field has been slow to adopt sophisticated methods to manage, process, analyze, and share the data and analyses afforded by said tools and approaches. This is in spite of the fact that open-source and collaborative tools are widely available. R, and its user-friendly workspace application RStudio (and it’s toolset), can help behavioral scientists become better stewards of their data, and produce more reproducible research.

This workshop will introduce the power of using R for managing, visualizing, and analyzing data with an explicit focus on reproducible research. In this workshop, we will introduce how R, RStudio, and RMarkdown can be leveraged to meet the ongoing and upcoming needs of researchers at all career levels. The workshop is designed for novice to intermediate R users. There is no expectation that attendees are currently using R to manage/analyze their data but we do expect that users come prepared to “live code” and follow along with the instructors during in-class activities.

A short introduction to R, RStudio, and RMarkdown will be given by the instructors. The remainder of the workshop will focus on example-driven instruction that will help attendees learn how to get started with R through using the RStudio application. Example data and analysis code will be made available, and attendees will be introduced to “tidy” data principles for importing, transforming, visualizing, and modeling data. Attendees will be also show how to use the RMarkdown document format and RStudio to create easily shareable and accessible documentation and analytical outputs. Attendees will have access to all workshop materials online for further review after completion of the workshop.

This Repo

This repo contains all of the slides, code, and information shared in seminar. Click on the hyperlinked section headings to navigate to content for that section.

Agenda

  • 8:30 - 8:45 - INTRODUCTIONS

  • 8:45 - 9:00: GETTING STARTED WITH R

    • R
    • RStudio
    • R Basics (Vectors, Data Frames, and Lists. Oh My!)
    • Packages
    • Intro to the Tidyverse & the Magic %>%
  • 9:00 - 9:30: READING IN DATA

    • Reading in Data
    • Getting to Know Your Data
    • Formatting Variables
    • EXERCISE 1: Reading in Multiple Files and Formatting Variables
  • 9:30 - 9:45: BREAK

  • 9:45 - 10:30: DATA MANIPULATION

    • Tidy Data
    • Transforming Data
    • Merging Data Sets
    • Deriving Data
    • Aggregating Data
    • EXERCISE 2: Data Cleaning and Derived Data
  • 10:30- 11:00: VISUALIZATION AND RMARKDOWN

    • ggplot2
    • Bar, Lines, and Dots
    • Formatting Your Plots
    • EXERCISE 3: Visualize Time Series Data
    • Intro to RMarkdown (if time allows)
  • 11:15 - 11:30: THE R COMMUNITY & RESOURCES

    • Texts
    • Websites & Blogs
    • Social Media
    • Conferences and IRL Groups

Your Instructors

Gina Merchant, PhD is a behavioral and data scientist with extensive experience working with technology to promote health behavior change. Dr. Merchant is a member of the UX Team at ResMed where she helps leverage empirical evidence, and combine UX and behavioral design in order to create digital solutions that improve patient engagement.

Ernesto Ramirez, PhD is the Director of Research and Development at Fitabase, the leading data management platform supporting consumer wearables for research and clinical trials. Since it's inception in 2016 Fitabase has supported over 450 different projects, processing and delivering over 4.5 billion minutes of data to researchers around the world.