Skip to contents

[Experimental] Generates a summary from a predefined summary of data within a REDCap project. The summary can be customized based on various options, such as cleaning the data, including metadata, and annotating metadata.

Usage

generate_project_summary(
  project,
  summary_name,
  transform,
  filter_field = NULL,
  filter_choices = NULL,
  filter_list = NULL,
  filter_strict = TRUE,
  field_names = NULL,
  form_names = NULL,
  no_duplicate_cols = FALSE,
  exclude_identifiers = TRUE,
  exclude_free_text = FALSE,
  date_handling = "none",
  upload_compatible = TRUE,
  clean = TRUE,
  drop_blanks = TRUE,
  drop_missings = FALSE,
  drop_others = NULL,
  include_metadata = TRUE,
  annotate_metadata = TRUE,
  include_record_summary = TRUE,
  include_users = TRUE,
  include_log = FALSE
)

Arguments

project

A validated project object containing REDCap project data and settings. Generated using load_project or setup_project

summary_name

Character. The name of the summary from which to generate the summary. *If you provide summary_name all other parameters are inherited according to what was set with add_project_summary.

transform

Logical. Whether to transform the data in the summary. Default is TRUE.

filter_field

Character. The name of the field in the database to filter on.

filter_choices

Vector. The values of filter_field used to define the summary.

filter_list

Vector. The values of filter_field used to define the summary.

filter_strict

Logical. If TRUE, all forms will be filtered by criteria. If FALSE, will convert original filter to id column and filter all other forms by that record. Default is TRUE.

field_names

Character vector. Names of specific fields to include in the summary. Default is NULL, which includes all fields.

form_names

Character vector. Names of forms to include in the summary. Default is NULL, which includes all forms.

no_duplicate_cols

A logical flag (TRUE or FALSE). If TRUE, the function will avoid including duplicate columns in the output. Defaults to FALSE.

exclude_identifiers

Logical. Whether to exlude identifiers in the data in the summary. Default is TRUE.

exclude_free_text

Logical for excluding free text. Default is FALSE.

date_handling

character string. One of none,lowest-overall-zero, lowest-record-zero, shuffle-record-randomly, or zero date date in form of 2012-12-05

upload_compatible

Logical. If TRUE, the data will be compatible with REDCap API upload. The main conflict is numeric or date variables in a project with missing codes while clean = TRUE. R converts these to NA. Default is TRUE.

clean

Logical. If TRUE, the data will be cleaned before summarizing. Default is TRUE.

drop_blanks

Logical. If TRUE, records with blank fields will be dropped. Default is TRUE.

drop_missings

Logical. If TRUE, will convert missing codes to NA. Default is FALSE.

drop_others

Character vector of other values that should be dropped.

include_metadata

Logical. If TRUE, metadata will be included in the summary. Default is TRUE.

annotate_metadata

Logical. If TRUE, metadata will be annotated in the summary. Default is TRUE.

include_record_summary

Logical. If TRUE, a record summary will be included in the generated summary. Default is TRUE.

include_users

Logical. If TRUE, user-related information will be included in the summary. Default is TRUE.

include_log

Logical. If TRUE, the log of changes will be included in the summary. Default is TRUE.

Value

A list containing the generated summary based on the specified options. The list includes filtered and cleaned data, metadata, and other summary details.

Details

This function allows you to generate a summary of data from a specific summary of records within the REDCap project. The function provides flexible options for cleaning, annotating, and including metadata, as well as controlling whether to include record summaries, user information, and logs.