saveData: Write Data to a Local Location or to Dropbox

Description Usage Arguments Value

View source: R/save_data.R

Description

Take a list of a specified format and save it to the specified location. All elements in the list must be either of same length or of length 1 because as.data.frame will be called on the list. The file name is created by pasting partId, Sys.time(), digest(data) and the suffix (and of course the file specification .rds or .csv).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
saveData(
  data,
  location,
  partId,
  checkNull = TRUE,
  addNameList = NULL,
  suffix = "_s",
  outputDir = NULL,
  droptoken = "droptoken.rds",
  asrds = FALSE,
  separator = ",",
  mailSender = NULL,
  mailReceiver = NULL,
  mailSubject = "ShinyPsych Data",
  mailBody = "Data attached..."
)

Arguments

data

list. Contains all the data that should be saved.

location

string. The location to which data should be saved. Valid inputs are "local" , "mail" or "dropbox".

partId

string. The participant id. This will be pasted to the beginning of the filename. If no id should be part of the filename leave this, in this case a sample of length 9 from 1:9 will be drawn and used as first part of the filename.

checkNull

logical. If TRUE (default), each value in the list that is NULL will be replaced by NA.

addNameList

string. Vector with length of data containing the variable names that should be given to the data. If names should not be change just leave this as NULL.

suffix

string. The suffix given to the name of the saved file. You could e.g. use "_s" (default) for the survey data and "_g" for the game data to have an easy distinction in the filenames.

outputDir

string. Directory WITHOUT the file name in which to save the data.

droptoken

string. Name of the rds file with the dropbox acces tokens. If this file is not in the app directory the full directory must be given. Only needed if location is set to "dropbox".

asrds

logical. If TRUE (default is FALSE), data is saved as an rds file.

separator

string. Separator that should be used to write the file. Default is ",".

mailSender

string. Mail sender address. Passed to sendmail from the sendmailR package.

mailReceiver

string. Mail receiver address. Passed to sendmail from the sendmailR package.

mailSubject

string. The mail subject. Passed to sendmail from the sendmailR package.

mailBody

string. The mail body. Passed to sendmail from the sendmailR package.

Value

incProcess for shiny to display a process bar. Data is written out.


mdsteiner/ShinyPsych documentation built on Feb. 12, 2022, 2:09 p.m.