exportForm: exportForm

Description Usage Arguments Note Author(s) Examples

View source: R/exportForm.R

Description

This function pulls forms from an odk server using ODK Briefcase. It's likely useful to set some of the parameters in variables, as they will be necessary to export the forms.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
exportForm(
  formid = NULL,
  exportDir = NULL,
  fileName = NULL,
  storage = getwd(),
  pemKey = NULL,
  geojson = FALSE,
  mediaInclude = TRUE,
  splitMultiple = TRUE,
  pullBefore = FALSE,
  rm_group_names = TRUE,
  oc = TRUE
)

Arguments

formid

The unique formid string for your server.

exportDir

Export Directory. If left NULL, the function will use odk_export in the working directory and create odk_export in the working directory if it doesn't exist.

fileName

Name of csv, must end in '.csv'

storage

Optional parameter, and defaults to your current working directory.

pemKey

Optional parameter, if the data is encrypted - this should be the filepath to the PEM key

geojson

Optional, logical parameter, defaults to TRUE. Mark false if you do not wish to include a geojson with geodata

mediaInclude

Optional, logical parameter, defauts to TRUE. If you wish to exclude media, mark FALSE

splitMultiple

Optional, logical parameter, defaults to TRUE. IF you do not wish to split 'select_multiple' type questions into separate columns, mark false.

pullBefore

Logical parameter, defaults to False. If you want to pull before export. Regardless, at least one manual pull is required fefore .

rm_group_names

Optional, defualts to TRUE. If you wish to include group names, mark FALSE

oc

Optional, defaults to TRUE. Set to true (default behavior), this will overwrite a previously exported CSV. Set to false, it will not. Note that you must change the name of your csv for the function to work if set to FALSE and you've already exported to the same directory with the same filename

Note

This function will check for and download ODK Briefcase. Make sure your firewalls allow for this the first time you run an odk function.

Author(s)

J.W. Rozelle

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# specify arguments

odkbc_storage   <- "<your/odk/storage/path>"
odkbc_export    <- "<your/export/file/path>"
random_id       <- "random_form_id"
random_filename <- "/exportdataname.csv"
odk_username    <- "MY_USERNAME"
odk_url         <- paste0("https://kc.humanitarianresponse.info/", odk_username)

pullForm(odk_url, odk_username, "PASSWORD", random_id, storage = odkbc_storage)

# Export ODK
exportForm(random_id, odkbc_export, random_filename, odkbc_storage)

jwilliamrozelle/figured documentation built on June 10, 2021, 5:32 p.m.