### Untitled No description -------------------------------- ### Untitled No description -------------------------------- ### Untitled No description -------------------------------- ### Install LaTeX Packages on Ubuntu Source: https://github.com/ouhscbbmc/redcapr/blob/main/documentation-for-developers/first-time-setup.md These commands install essential LaTeX packages on Ubuntu for building R package documentation, specifically the reference manual. It addresses potential issues with missing fonts and texi2dvi. ```shell sudo apt-get install texinfo sudo apt-get install texlive sudo apt-get install texlive-fonts-extra ``` -------------------------------- ### Add qpdf to System PATH (Windows Example) Source: https://github.com/ouhscbbmc/redcapr/blob/main/documentation-for-developers/first-time-setup.md This example shows how to add the qpdf 'bin' directory to the Windows system's PATH environmental variable. This is crucial for R's build and check processes, particularly for PDF compression checks. ```shell C:\Program Files\qpdf-5.0.1\bin; ``` -------------------------------- ### Untitled No description -------------------------------- ### Install R Package Dependencies Source: https://github.com/ouhscbbmc/redcapr/blob/main/documentation-for-developers/first-time-setup.md This R script installs all the necessary R packages required for the REDCapR project. It is located in the '/utility_scripts/package_dependencies.R' file and helps ensure new contributors have a consistent development environment. ```R source("/utility_scripts/package_dependencies.R") ``` -------------------------------- ### Untitled No description -------------------------------- ### Untitled No description -------------------------------- ### Install qpdf on Red Hat Linux Source: https://github.com/ouhscbbmc/redcapr/blob/main/documentation-for-developers/first-time-setup.md This command installs the qpdf utility on Red Hat-based Linux distributions using the yum package manager. qpdf is a command-line tool used by R's build process for checking PDF compression. ```shell yum install qpdf ``` -------------------------------- ### Untitled No description -------------------------------- ### Untitled No description -------------------------------- ### Untitled No description -------------------------------- ### Install REDCapR Package (Development) Source: https://github.com/ouhscbbmc/redcapr/blob/main/README.md Installs the development version of the REDCapR package from GitHub. This requires the 'remotes' package and provides access to the latest features and bug fixes. ```r install.packages("remotes") # Run this line if the 'remotes' package isn't installed already. remotes::install_github("OuhscBbmc/REDCapR") ``` -------------------------------- ### Untitled No description -------------------------------- ### Untitled No description -------------------------------- ### Install REDCapR Package (CRAN) Source: https://github.com/ouhscbbmc/redcapr/blob/main/README.md Installs the stable release version of the REDCapR package from the Comprehensive R Archive Network (CRAN). This is the recommended method for most users. ```r install.packages("REDCapR") ``` -------------------------------- ### Install RODBC and unixODBC on Linux (Ubuntu/Red Hat) Source: https://github.com/ouhscbbmc/redcapr/blob/main/documentation-for-developers/retired-documentation.md These shell commands install the RODBC package and its dependencies (unixODBC) on Ubuntu and Red Hat Linux distributions. RODBC is required for the RODBCext R package. ```shell #From Ubuntu terminal sudo apt-get install r-cran-rodbc unixodbc-dev ``` ```shell #From Red Hat terminal sudo yum install R-RODBC unixODBC-devel ``` -------------------------------- ### Untitled No description -------------------------------- ### Untitled No description -------------------------------- ### Check REDCapR Installation on Linux Source: https://github.com/ouhscbbmc/redcapr/blob/main/documentation-for-developers/retired-documentation.md This R code snippet checks the REDCapR installation on a Linux system. It bypasses the RODBC package installation, which is not essential for core REDCapR functionality. Ensure the working directory is set to the REDCapR project root. ```r devtools::check(force_suggests = FALSE) ``` -------------------------------- ### Untitled No description -------------------------------- ### SVN Commands for Deleting a Directory Source: https://github.com/ouhscbbmc/redcapr/blob/main/documentation-for-developers/retired-documentation.md This example demonstrates how to delete a directory using SVN commands. It includes updating the repository and then committing the deletion. This is useful for managing files within the REDCapR project. ```shell $ svn update doc $ svn delete doc $ svn commit -m "Deleted directory 'inst/doc'." ``` -------------------------------- ### Untitled No description -------------------------------- ### Untitled No description -------------------------------- ### REDCap Data Dictionary CSV Example Source: https://github.com/ouhscbbmc/redcapr/blob/main/inst/test-data/project-color-boxes/Readme.md This CSV snippet represents a REDCap data dictionary. It defines fields such as 'id' (text) and 'color' (checkbox with multiple options). Each column specifies metadata for a field within the REDCap project. ```csv "Variable / Field Name","Form Name","Section Header","Field Type","Field Label","Choices, Calculations, OR Slider Labels","Field Note","Text Validation Type OR Show Slider Number","Text Validation Min","Text Validation Max",Identifier?","Branching Logic (Show field only if...)","Required Field?","Custom Alignment","Question Number (surveys only)","Matrix Group Name","Matrix Ranking?" id,thisform,,text,"Subject ID",,,,,,,,,,,, color,thisform,,checkbox,Color,"r, Red | g, Green | b, Blue | p, Purple",,,,,,,,,, ``` -------------------------------- ### REDCap Dataset CSV Example Source: https://github.com/ouhscbbmc/redcapr/blob/main/inst/test-data/project-color-boxes/Readme.md This CSV snippet illustrates a REDCap dataset. It includes subject IDs and data for the 'color' checkbox field, where each option is represented as a separate column (e.g., color___r, color___g). The 'thisform_complete' column indicates form completion status. ```csv id,redcap_data_access_group,color___r,color___g,color___b,color___p,thisform_complete "1","",1,0,0,0,0 "2","",0,0,1,0,0 "3","",0,1,1,0,0 "4","",0,0,0,0,0 ``` -------------------------------- ### Untitled No description -------------------------------- ### Untitled No description -------------------------------- ### Untitled No description -------------------------------- ### Untitled No description -------------------------------- ### Untitled No description -------------------------------- ### Untitled No description -------------------------------- ### Untitled No description -------------------------------- ### Untitled No description -------------------------------- ### Untitled No description -------------------------------- ### Untitled No description -------------------------------- ### Batch Configuration for Large REDCap Datasets in R Source: https://context7.com/ouhscbbmc/redcapr/llms.txt This section explains how to manage performance and avoid server timeouts when dealing with large datasets by configuring batch sizes and delays. It demonstrates setting smaller batch sizes with longer delays for servers with limitations, and larger batches with shorter delays for more robust servers. Batching options are also available for `redcap_write` operations. ```r # Small batches for server with limitations result <- redcap_read( redcap_uri = uri, token = token, batch_size = 50, interbatch_delay = 1.0 ) # Larger batches for robust servers result_fast <- redcap_read( redcap_uri = uri, token = token, batch_size = 500, interbatch_delay = 0.1 ) # Write with batching result_write <- redcap_write( ds = large_dataset, redcap_uri = uri, token = token, batch_size = 100, continue_on_error = FALSE ) ``` -------------------------------- ### Untitled No description -------------------------------- ### Untitled No description -------------------------------- ### REDCap API URL and Token Configuration in R Source: https://github.com/ouhscbbmc/redcapr/blob/main/inst/test-data/project-color-boxes/Readme.md This R snippet defines the URL and API token for accessing a REDCap project. These variables are essential for making authenticated requests to the REDCap API using libraries like httr. ```r url <- "https://redcap-dev-2.ouhsc.edu/redcap/api" token <- "BECD55331CA005887DA3543230E10284" ``` -------------------------------- ### Export REDCap User Permissions Source: https://context7.com/ouhscbbmc/redcapr/llms.txt Lists all users with access to a project and their form-level permissions. Exports user-level information (username, email, etc.) and a user-form permission matrix. Requires REDCap URI and API token. Returns a list containing user data and user-form permission data. ```r # Export user list result <- redcap_users_export( redcap_uri = uri, token = token ) # View user-level information users <- result$data_user print(users[, c("username", "email", "firstname", "lastname", "data_export")]) # View user-form permissions matrix user_forms <- result$data_user_form print(head(user_forms)) # Filter to specific users admin_users <- users[users$design == 1, ] export_users <- users[users$data_export == 1, ] ``` -------------------------------- ### Export REDCap Project Information Source: https://context7.com/ouhscbbmc/redcapr/llms.txt Retrieves project-level metadata such as title, creation date, longitudinal status, and survey settings. Supports setting locale for timezone awareness. Requires REDCap URI and API token. Returns a list containing the project information data frame. ```r # Get project information with timezone awareness library(readr) result <- redcap_project_info_read( redcap_uri = uri, token = token, locale = locale(tz = "America/Chicago") ) project_info <- result$data # Examine key attributes print(project_info[, c( "project_title", "creation_time", "is_longitudinal", "surveys_enabled", "in_production" )]) # Check if project has repeating instruments if (result$success) { cat("Project:", project_info$project_title, "\n") cat("Longitudinal:", project_info$is_longitudinal, "\n") cat("Record count:", project_info$record_count, "\n") } ``` -------------------------------- ### Untitled No description -------------------------------- ### Fetch All Records with Checkbox Data using REDCapR in R Source: https://github.com/ouhscbbmc/redcapr/blob/main/inst/test-data/project-color-boxes/Readme.md This R code demonstrates fetching all records from a REDCap project using the httr::POST function. It specifically requests the 'id' and 'color' fields, processing the CSV response into a data frame. The output shows how checkbox options are expanded into separate columns. ```r url <- "https://redcap-dev-2.ouhsc.edu/redcap/api/" token <- "BECD55331CA005887DA3543230E10284" post_result_all <- httr::POST(url=url, body=list(token=token, content='record', format='csv', rawOrLabel='label', fields='id, color')) (csv_all <- as.character(post_result_all)) (ds_all <- read.csv(textConnection(csv_all))) ``` -------------------------------- ### Untitled No description -------------------------------- ### Untitled No description -------------------------------- ### Specify arm for redcap_event_instruments in REDCapR Source: https://github.com/ouhscbbmc/redcapr/blob/main/NEWS.md Shows how to specify a particular arm when calling `redcap_event_instruments()` in REDCapR to replicate the previous default behavior of returning mappings for only the first arm. This is useful for backward compatibility or specific data extraction needs. ```r REDCapR::redcap_event_instruments(uri, token_2, arms = "1") ```