Package 'surveycto'

Title: Manipulation of Data Collected through XLSFORM-compliant Platforms
Description: SurveyCTO package is a metapackages that is comprised of specilized functions to organize, manipulate and analyze data collected through XLSFOrm-compliant platforms such as SurveyCTO,ODK, ONA,Kobotoolbox.However,some function(s) may be used with any structured.This system provides an enormous opportunity in automation of the workflow of survey data collection, processing, analsysis and visualization. The main purpose this package is to compile functions that can be used to develop live dashboard(s) during data collection. This make it easy to track data quality during data collection and also gives data manager(s) time to discover insights in the data. Using the functions in this package it relative easy to develop shiny dashboards.
Authors: "Waiguru Muriuki", email="[email protected]"
Maintainer: The package maintainer <[email protected]>
License: GPL (>= 2)
Version: 0.1.0
Built: 2024-09-24 04:59:27 UTC
Source: https://github.com/Waiguru254/surveycto

Help Index


Checkbox or Multiple choice Tabulation

Description

Tabulation of checkbox or multiple choice columns

Usage

ctoimport(
    column,
    decimal = 1,
  )

Arguments

column

A multiple choice or checkbox column

decimal

Number of decimal point for the percentages

Examples

NOT RUN
  checkbox(column,decimal)

Fetching Data from SurveyCTO server using API.

Description

The function fetch data from surveycto server using formid, which is a form identifier. It imports data in .csv format, without repeat group data.

Usage

ctoimport(
  servername,
  formid,
  username,
  password,
  dataName = NULL,
  language = ""
)

Arguments

servername

SurveyCTO servername

formid

Get this from Setting sheet in the XLSForm workbook or in the form definition in the server.

username

SurveyCTO username, without including the .survecto.com

password

SurveyCTO password, it is encouraged not to put the password in a plain text in your script. Employ it in

dataName

Name of the data to be stored in R memory, default is data.

language

This determines that labels language to be used to label the data.

Examples

## NOT RUN
 ctoimport(Sys.getenv("servername"),'VAVS_CRF_03',Sys.getenv("username"),Sys.getenv("password"))

Evaluating Duplicates in a column (Indexing or Counting)

Description

Evaluating Duplicates in a column (Indexing or Counting)

Usage

dup_tag(
    column,
    index=FALSE,
    na.rm = TRUE,
  )

Arguments

column

the column where ducplicated are beign evaluated

index

FALSE is one wants the duplicates to be indixed, and TRUE for duplicated to be indicated by number of occurence.

na.rm

TRUE is you want NA or empty responses to be evaluated...

Examples

##NOT RUN
  ##dup_tag(column)

Fetching data from KoboToolBox using API (even Humanitarian)

Description

KoBoToolBox provides a suites of tools to collect data in challenging environment. It is free and opne source and work both online and offline. KoboTool Box also provides advanced feature and make it useful in advanced scenarios.It provide data access through RESTAPI, which automte the workflow of data colelection, processing and visualization. This is possible even the project is no public, using username and password authentication.

Usage

koboimport(servername, formid, username, password)

Arguments

servername

either 'kobo.humanitarianresponse.info/' or 'kc.kobotoolbox.org' However, the current function is largely build to stream data from kobotoolbox.org.

formid

To download data, a unique identifier of the form is needed to construct a URL used to fetch data. The fetch data from a given form login to the server and click the form and navigate the the form tab. From the link, the text between forward slash(/)(after "forms" and before "landing"). For example, https://kf.kobotoolbox.org/#/forms/aTxwr9Fg4ouTYnRN5tHq2z/landing formid='aTxwr9Fg4ouTYnRN5tHq2z'

username

your username

password

you password

Examples

###Not run
data<-koboimport(servername,form_id,username,password)

Calculates the mean by group

Description

Calculates the mean by group

Usage

odkmean(row, column, data)

Arguments

row

Numeric variable

column

Group variable

data

data where with row and column variables

Examples

odkmean('row','column','data')

Fetching data from Project's RedCap server using API

Description

Fetching data from Project's RedCap server using API

Usage

redimport(token, url)

Arguments

token

This is the unique identifier of projects in RedCap. This function uses the token to fetch data using API.

url

This is the link to the Redcap API. An example is 'https://redcap.xxxxxxxx/api/'

Examples

###NOT RUN
redimport('token','url')

Compiling Multiple Variable Choices.

Description

Compiling Multiple Variable Choices.

Usage

rodkmult(xlsform, dataName)

Arguments

xlsform

Latest XLSFORM used to collect data.The variable and value labels will be used to label the data.

dataName

The name of the data in the memory collected using the survey.

Examples

NOT run
rodkmult(xlsforn,'dataName')

Compile Multiple Select variable value labels into a data.frame.

Description

Compile Multiple Select variable value labels into a data.frame.

Usage

rodkmultlab(xlsform)

Arguments

xlsform

Lasted XLSFORM used to collect the data.

Examples

NOT run
rodkmultlab(xlsforn,'dataName')

Compile Single Select variable value label into data.frame.

Description

Compile Single Select variable value label into data.frame.

Usage

rodksinglelab(xlsform)

Arguments

xlsform

Lastest XLSFORM used to collect data.

Examples

NOT run
rodksinglelab(xlsform)

Generates a Script to add single variable value labels.

Description

The function uses expss package to label data.

Usage

rodkval(xlsform, dataName, language = "")

Arguments

xlsform

Latest XLSFORM used to collect the data.

dataName

Use the name used to save the data, in R memory, collected using the XLS-form stated above. stated above.

language

Enter the language to be used in value labelling. If the language is not provided, the most left label column will be used to generate the value label script. For example, language="English".

Examples

NOT run
rodkmult(xlsforn,'dataName','English')

Generates Rscript to add variable labels

Description

Generates Rscript to add variable labels

Usage

rodkvar(dataName = "", language = "")

Arguments

dataName

name given to the data.frame collected using the XLSFORM stated

xlsform

Latest XLSFORM used to collect data.

Examples

Not run
rodkvar(xlsforn,'dataName')

Compiling Variable type into a data.frame from XLSFORM

Description

Compiling Variable type into a data.frame from XLSFORM

Usage

rodkvartype(xlsform)

Arguments

xlsform

Latest XLSFORM used to collect the data.

Examples

#Not run
rodkvartype(xlsform)

Import the survey Form Definition and Generates the Labels dateframes

Description

The function stream survey Form defination and generates a list of datasets; choices survey, variable type,and variable name against the labels.

Usage

surveyImport(
  servername,
  formid,
  username,
  password,
  language = "",
  dataName = NULL
)

Arguments

servername

Servername where the data is hosted

formid

Form ID is the data to be streamed

username

Server username

password

Sever password

language

XLS form language to add the labels

dataName

Name of the datset to be stored in R memory.

Examples

#NOT RUN
 dd<-surveyImport(Sys.getenv("servername"),'VAVS_CRF_06',Sys.getenv("username"),Sys.getenv("password"))

The function generate proportion from a multiple-select variable

Description

The function generate proportion from a multiple-select variable

Usage

tabmult(row, column, data)

Arguments

row

Multiple-select variable

column

Group by variable

data

data with multiple select variable

Examples

tabmmult('row','column','data','valuelabel')

Tabulates single select variables by group.

Description

Tabulates single select variables by group.

Usage

tabx(row, column, data)

Arguments

row

Variable to tabulate

column

Group variable.

data

Data collected using the ODK platform

Examples

tabx('row','column','data')

Converts String text into Proper Format

Description

Converts String text into Proper Format

Usage

toproper(x)

Arguments

x

String or variable to be converted to proper

Examples

toproper(data$row)

Compile Variable (Column label) labels into data.frame.

Description

Compile Variable (Column label) labels into data.frame.

Usage

varlabs(xlsform)

Arguments

xlsform

Lastest XLSForm used to collect data.

Examples

NOT RUN
varlabs(xlsform)