make_tidier_table: Make submissions table more tidy

Description Usage Arguments Examples

View source: R/organize-data.R

Description

Make the submissions table more tidy. New table will have columns "form_data_id", "section", "variable", "response". Submission ids are moved to the "form_data_id" column from the original column names. Submission responses are moved to the "response" column, and "variables" that correspond to the responses are broken into the two columns "section" and "variable". These two columns fill from the left. See the example for clarification.

Usage

1

Arguments

data

Data frame with the submissions in the form given by 'download_all_and_get_table()', which has a "variables" column and a column for each submission with the form_data_id as the column name.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data <- tibble::tribble(
  ~variables, ~sub1, ~sub2,
  "naming.first_name", "Mel", "Jimothy",
  "naming.last_name", "Jovin", "Smithery",
  "exercise.pushups.min", "10", "3",
  "exercise.pushups.max", "20", "12",
  "exercise.pullups.reps.min", "1", "1",
  "exercise.pullups.reps.max", "2", "3"
)
tidier_data <- make_tidier_table(data)

Sage-Bionetworks/synapseforms documentation built on June 16, 2020, 8:35 a.m.