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-11-23 04:33:39 UTC |
Source: | https://github.com/Waiguru254/surveycto |
Tabulation of checkbox or multiple choice columns
ctoimport( column, decimal = 1, )
ctoimport( column, decimal = 1, )
column |
A multiple choice or checkbox column |
decimal |
Number of decimal point for the percentages |
NOT RUN checkbox(column,decimal)
NOT RUN checkbox(column,decimal)
The function fetch data from surveycto server using formid, which is a form identifier. It imports data in .csv format, without repeat group data.
ctoimport( servername, formid, username, password, dataName = NULL, language = "" )
ctoimport( servername, formid, username, password, dataName = NULL, language = "" )
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. |
## NOT RUN ctoimport(Sys.getenv("servername"),'VAVS_CRF_03',Sys.getenv("username"),Sys.getenv("password"))
## NOT RUN ctoimport(Sys.getenv("servername"),'VAVS_CRF_03',Sys.getenv("username"),Sys.getenv("password"))
Evaluating Duplicates in a column (Indexing or Counting)
dup_tag( column, index=FALSE, na.rm = TRUE, )
dup_tag( column, index=FALSE, na.rm = TRUE, )
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... |
##NOT RUN ##dup_tag(column)
##NOT RUN ##dup_tag(column)
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.
koboimport(servername, formid, username, password)
koboimport(servername, formid, username, password)
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 |
###Not run data<-koboimport(servername,form_id,username,password)
###Not run data<-koboimport(servername,form_id,username,password)
Calculates the mean by group
odkmean(row, column, data)
odkmean(row, column, data)
row |
Numeric variable |
column |
Group variable |
data |
data where with row and column variables |
odkmean('row','column','data')
odkmean('row','column','data')
Fetching data from Project's RedCap server using API
redimport(token, url)
redimport(token, url)
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/' |
###NOT RUN redimport('token','url')
###NOT RUN redimport('token','url')
Compiling Multiple Variable Choices.
rodkmult(xlsform, dataName)
rodkmult(xlsform, dataName)
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. |
NOT run rodkmult(xlsforn,'dataName')
NOT run rodkmult(xlsforn,'dataName')
Compile Multiple Select variable value labels into a data.frame.
rodkmultlab(xlsform)
rodkmultlab(xlsform)
xlsform |
Lasted XLSFORM used to collect the data. |
NOT run rodkmultlab(xlsforn,'dataName')
NOT run rodkmultlab(xlsforn,'dataName')
Compile Single Select variable value label into data.frame.
rodksinglelab(xlsform)
rodksinglelab(xlsform)
xlsform |
Lastest XLSFORM used to collect data. |
NOT run rodksinglelab(xlsform)
NOT run rodksinglelab(xlsform)
The function uses expss package to label data.
rodkval(xlsform, dataName, language = "")
rodkval(xlsform, dataName, language = "")
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". |
NOT run rodkmult(xlsforn,'dataName','English')
NOT run rodkmult(xlsforn,'dataName','English')
Generates Rscript to add variable labels
rodkvar(dataName = "", language = "")
rodkvar(dataName = "", language = "")
dataName |
name given to the data.frame collected using the XLSFORM stated |
xlsform |
Latest XLSFORM used to collect data. |
Not run rodkvar(xlsforn,'dataName')
Not run rodkvar(xlsforn,'dataName')
Compiling Variable type into a data.frame from XLSFORM
rodkvartype(xlsform)
rodkvartype(xlsform)
xlsform |
Latest XLSFORM used to collect the data. |
#Not run rodkvartype(xlsform)
#Not run rodkvartype(xlsform)
The function stream survey Form defination and generates a list of datasets; choices survey, variable type,and variable name against the labels.
surveyImport( servername, formid, username, password, language = "", dataName = NULL )
surveyImport( servername, formid, username, password, language = "", dataName = NULL )
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. |
#NOT RUN dd<-surveyImport(Sys.getenv("servername"),'VAVS_CRF_06',Sys.getenv("username"),Sys.getenv("password"))
#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
tabmult(row, column, data)
tabmult(row, column, data)
row |
Multiple-select variable |
column |
Group by variable |
data |
data with multiple select variable |
tabmmult('row','column','data','valuelabel')
tabmmult('row','column','data','valuelabel')
Tabulates single select variables by group.
tabx(row, column, data)
tabx(row, column, data)
row |
Variable to tabulate |
column |
Group variable. |
data |
Data collected using the ODK platform |
tabx('row','column','data')
tabx('row','column','data')
Converts String text into Proper Format
toproper(x)
toproper(x)
x |
String or variable to be converted to proper |
toproper(data$row)
toproper(data$row)
Compile Variable (Column label) labels into data.frame.
varlabs(xlsform)
varlabs(xlsform)
xlsform |
Lastest XLSForm used to collect data. |
NOT RUN varlabs(xlsform)
NOT RUN varlabs(xlsform)