run_demographic_report: Function to run the master demo data pull for a...

Description Usage Arguments Value Examples

View source: R/utils.R

Description

Function that can be used to mount remote data if needed, run a demographic report, and chose how the result is saved. Will return NA if return_data and return_demo are not TRUE. Otherwise will return a list with either or both the data and demographic results.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
run_demographic_report(
  cfg,
  protocol,
  task,
  other_fields = c(),
  out_dir = getwd(),
  load_env = FALSE,
  mnt_path = NA,
  remote_name = NA,
  remote_path = NA,
  max_attempts = 5,
  trap = FALSE,
  save = FALSE,
  include_timestamp = FALSE,
  return_data = FALSE,
  return_demo = FALSE,
  ...
)

Arguments

cfg

is the path to the lab's json configuration file. (Required)

protocol

is the project we want data from.

task

is the specific task we want data for.

other_fields

a vector of extra fields to get from Master Demo.

load_env

if set to TRUE, will load the data to the global env.

mnt_path

is the directory to try and remount.

remote_name

is the name of the configured rclone remote.

remote_path

is the path to the remote directory to mount locally.

max_attempts

sets the max number of mount attempts.

trap

if set to TRUE, the mount will not persist after the session.

save

if set to TRUE, will save the results as csvs.

include_timestamp

will add a timestamp to the saved output.

return_data

if set to TRUE will return the resultant dataframe.

return_demo

if set to TRUE will return the resultant demographic.

attempt

sets the attempt number you are on.

Value

Based on return_data and return_demo inputs.

Examples

1
2
run_demographic_report(cfg="/Volumes/bierka_root/datamesh/behav/redcap3.json",
protocol="bsocial", task="trust", load_env=TRUE)

DecisionNeurosciencePsychopathology/DataTracker documentation built on Jan. 20, 2022, 4:51 p.m.