mirror of
https://github.com/agdamsbo/REDCapCAST.git
synced 2024-11-27 23:31:54 +01:00
adjusting
This commit is contained in:
parent
2ba46e8e7a
commit
d1425aaac0
@ -71,6 +71,7 @@ Collate:
|
|||||||
'ds2dd_detailed.R'
|
'ds2dd_detailed.R'
|
||||||
'easy_redcap.R'
|
'easy_redcap.R'
|
||||||
'export_redcap_instrument.R'
|
'export_redcap_instrument.R'
|
||||||
|
'fct_drop.R'
|
||||||
'html_styling.R'
|
'html_styling.R'
|
||||||
'mtcars_redcap.R'
|
'mtcars_redcap.R'
|
||||||
'read_redcap_instrument.R'
|
'read_redcap_instrument.R'
|
||||||
|
10
NAMESPACE
10
NAMESPACE
@ -1,17 +1,21 @@
|
|||||||
# Generated by roxygen2: do not edit by hand
|
# Generated by roxygen2: do not edit by hand
|
||||||
|
|
||||||
S3method(as_factor,character)
|
S3method(as_factor,character)
|
||||||
|
S3method(as_factor,data.frame)
|
||||||
S3method(as_factor,factor)
|
S3method(as_factor,factor)
|
||||||
S3method(as_factor,haven_labelled)
|
S3method(as_factor,haven_labelled)
|
||||||
S3method(as_factor,labelled)
|
S3method(as_factor,labelled)
|
||||||
S3method(as_factor,logical)
|
S3method(as_factor,logical)
|
||||||
S3method(as_factor,numeric)
|
S3method(as_factor,numeric)
|
||||||
|
S3method(as_factor,redcapcast_labelled)
|
||||||
S3method(process_user_input,character)
|
S3method(process_user_input,character)
|
||||||
S3method(process_user_input,data.frame)
|
S3method(process_user_input,data.frame)
|
||||||
S3method(process_user_input,default)
|
S3method(process_user_input,default)
|
||||||
S3method(process_user_input,response)
|
S3method(process_user_input,response)
|
||||||
export(REDCap_split)
|
export(REDCap_split)
|
||||||
export(all_na)
|
export(all_na)
|
||||||
|
export(apply_factor_labels)
|
||||||
|
export(apply_field_label)
|
||||||
export(as_factor)
|
export(as_factor)
|
||||||
export(case_match_regex_list)
|
export(case_match_regex_list)
|
||||||
export(cast_data_overview)
|
export(cast_data_overview)
|
||||||
@ -30,6 +34,8 @@ export(ds2dd_detailed)
|
|||||||
export(easy_redcap)
|
export(easy_redcap)
|
||||||
export(export_redcap_instrument)
|
export(export_redcap_instrument)
|
||||||
export(fct2num)
|
export(fct2num)
|
||||||
|
export(fct_drop)
|
||||||
|
export(fct_drop.data.frame)
|
||||||
export(file_extension)
|
export(file_extension)
|
||||||
export(focused_metadata)
|
export(focused_metadata)
|
||||||
export(format_subheader)
|
export(format_subheader)
|
||||||
@ -39,6 +45,7 @@ export(guess_time_only)
|
|||||||
export(guess_time_only_filter)
|
export(guess_time_only_filter)
|
||||||
export(haven_all_levels)
|
export(haven_all_levels)
|
||||||
export(html_tag_wrap)
|
export(html_tag_wrap)
|
||||||
|
export(is.labelled)
|
||||||
export(is_repeated_longitudinal)
|
export(is_repeated_longitudinal)
|
||||||
export(match_fields_to_form)
|
export(match_fields_to_form)
|
||||||
export(named_levels)
|
export(named_levels)
|
||||||
@ -49,9 +56,7 @@ export(possibly_roman)
|
|||||||
export(process_user_input)
|
export(process_user_input)
|
||||||
export(read_input)
|
export(read_input)
|
||||||
export(read_redcap_instrument)
|
export(read_redcap_instrument)
|
||||||
export(read_redcap_labelled)
|
|
||||||
export(read_redcap_tables)
|
export(read_redcap_tables)
|
||||||
export(redcap_meta_default)
|
|
||||||
export(redcap_wider)
|
export(redcap_wider)
|
||||||
export(sanitize_split)
|
export(sanitize_split)
|
||||||
export(set_attr)
|
export(set_attr)
|
||||||
@ -64,6 +69,7 @@ importFrom(REDCapR,redcap_event_instruments)
|
|||||||
importFrom(REDCapR,redcap_metadata_read)
|
importFrom(REDCapR,redcap_metadata_read)
|
||||||
importFrom(REDCapR,redcap_read)
|
importFrom(REDCapR,redcap_read)
|
||||||
importFrom(forcats,as_factor)
|
importFrom(forcats,as_factor)
|
||||||
|
importFrom(forcats,fct_drop)
|
||||||
importFrom(keyring,key_get)
|
importFrom(keyring,key_get)
|
||||||
importFrom(keyring,key_list)
|
importFrom(keyring,key_list)
|
||||||
importFrom(keyring,key_set)
|
importFrom(keyring,key_set)
|
||||||
|
6
NEWS.md
6
NEWS.md
@ -2,7 +2,11 @@
|
|||||||
|
|
||||||
The hosting on shinyapps.io has given a lot of trouble recently. Modyfied package structure a little around the `shiny_cast()`, to accommodate an alternative hosting approach with all package functions included in a script instead of requiring the package.
|
The hosting on shinyapps.io has given a lot of trouble recently. Modyfied package structure a little around the `shiny_cast()`, to accommodate an alternative hosting approach with all package functions included in a script instead of requiring the package.
|
||||||
|
|
||||||
* read_readcap_labelled():
|
* NEW: A new option to `raw_or_label` in `read_readcap_tables()` has been added: "both". Get raw values with REDCap labels applied as labels. Use `as_factor()` to format factors with original labels and use the `gtsummary` package to easily get beautiful tables with original labels from REDCap. Use `fct_drop()` to drop empty levels.
|
||||||
|
|
||||||
|
* NEW: fct_drop() has been added with an extension to `forcats::fct_drop()`, that works across data.frames. Use as `fct_drop()`.
|
||||||
|
|
||||||
|
* CHANGE: the default data export method of `easy_redcap()` has been changed to use the new labelled data export with `read_readcap_tables()`.
|
||||||
|
|
||||||
# REDCapCAST 24.11.3
|
# REDCapCAST 24.11.3
|
||||||
|
|
||||||
|
@ -99,26 +99,6 @@ hms2character <- function(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#' Default column names of a REDCap data dictionary
|
|
||||||
#'
|
|
||||||
#' @param ... ignored for now
|
|
||||||
#'
|
|
||||||
#' @return character vector
|
|
||||||
#' @export
|
|
||||||
#'
|
|
||||||
#' @examples
|
|
||||||
#' dput(redcap_meta_default())
|
|
||||||
redcap_meta_default <- function(...) {
|
|
||||||
c(
|
|
||||||
"field_name", "form_name", "section_header", "field_type",
|
|
||||||
"field_label", "select_choices_or_calculations", "field_note",
|
|
||||||
"text_validation_type_or_show_slider_number", "text_validation_min",
|
|
||||||
"text_validation_max", "identifier", "branching_logic", "required_field",
|
|
||||||
"custom_alignment", "question_number", "matrix_group_name", "matrix_ranking",
|
|
||||||
"field_annotation"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
#' (DEPRECATED) Data set to data dictionary function
|
#' (DEPRECATED) Data set to data dictionary function
|
||||||
#'
|
#'
|
||||||
#' @description
|
#' @description
|
||||||
@ -141,7 +121,7 @@ redcap_meta_default <- function(...) {
|
|||||||
#' @param include.column.names Flag to give detailed output including new
|
#' @param include.column.names Flag to give detailed output including new
|
||||||
#' column names for original data set for upload.
|
#' column names for original data set for upload.
|
||||||
#' @param metadata Metadata column names. Default is the included
|
#' @param metadata Metadata column names. Default is the included
|
||||||
#' REDCapCAST::redcap_meta_default.
|
#' names(REDCapCAST::redcapcast_meta).
|
||||||
#'
|
#'
|
||||||
#' @return data.frame or list of data.frame and vector
|
#' @return data.frame or list of data.frame and vector
|
||||||
#' @export
|
#' @export
|
||||||
@ -157,7 +137,7 @@ ds2dd <-
|
|||||||
field.type = "text",
|
field.type = "text",
|
||||||
field.label = NULL,
|
field.label = NULL,
|
||||||
include.column.names = FALSE,
|
include.column.names = FALSE,
|
||||||
metadata = REDCapCAST::redcap_meta_default()
|
metadata = names(REDCapCAST::redcapcast_meta)
|
||||||
) {
|
) {
|
||||||
dd <- data.frame(matrix(ncol = length(metadata), nrow = ncol(ds)))
|
dd <- data.frame(matrix(ncol = length(metadata), nrow = ncol(ds)))
|
||||||
colnames(dd) <- metadata
|
colnames(dd) <- metadata
|
||||||
@ -244,7 +224,7 @@ ds2dd <-
|
|||||||
#' or attribute `factor.labels.attr` for haven_labelled data set (imported .dta
|
#' or attribute `factor.labels.attr` for haven_labelled data set (imported .dta
|
||||||
#' file with `haven::read_dta()`).
|
#' file with `haven::read_dta()`).
|
||||||
#' @param metadata redcap metadata headings. Default is
|
#' @param metadata redcap metadata headings. Default is
|
||||||
#' REDCapCAST::redcap_meta_default().
|
#' names(REDCapCAST::redcapcast_meta).
|
||||||
#' @param convert.logicals convert logicals to factor. Default is TRUE.
|
#' @param convert.logicals convert logicals to factor. Default is TRUE.
|
||||||
#'
|
#'
|
||||||
#' @return list of length 2
|
#' @return list of length 2
|
||||||
@ -286,7 +266,7 @@ ds2dd_detailed <- function(data,
|
|||||||
field.label = NULL,
|
field.label = NULL,
|
||||||
field.label.attr = "label",
|
field.label.attr = "label",
|
||||||
field.validation = NULL,
|
field.validation = NULL,
|
||||||
metadata = REDCapCAST::redcap_meta_default(),
|
metadata = names(REDCapCAST::redcapcast_meta),
|
||||||
convert.logicals = TRUE) {
|
convert.logicals = TRUE) {
|
||||||
|
|
||||||
if (convert.logicals) {
|
if (convert.logicals) {
|
||||||
|
BIN
R/sysdata.rda
BIN
R/sysdata.rda
Binary file not shown.
@ -7,9 +7,9 @@
|
|||||||
# "matrix_ranking", "field_annotation"
|
# "matrix_ranking", "field_annotation"
|
||||||
# )
|
# )
|
||||||
|
|
||||||
# metadata_names <- REDCapR::redcap_metadata_read(
|
metadata_names <- REDCapR::redcap_metadata_read(
|
||||||
# redcap_uri = keyring::key_get("DB_URI"),
|
redcap_uri = keyring::key_get("DB_URI"),
|
||||||
# token = keyring::key_get("cast_api")
|
token = keyring::key_get("cast_api")
|
||||||
# )$data |> names()
|
)$data |> names()
|
||||||
#
|
|
||||||
# usethis::use_data(metadata_names, overwrite = TRUE, internal = TRUE)
|
usethis::use_data(metadata_names, overwrite = TRUE, internal = TRUE)
|
||||||
|
@ -15,7 +15,7 @@ ds2dd_detailed(
|
|||||||
field.label = NULL,
|
field.label = NULL,
|
||||||
field.label.attr = "label",
|
field.label.attr = "label",
|
||||||
field.validation = NULL,
|
field.validation = NULL,
|
||||||
metadata = REDCapCAST::redcap_meta_default(),
|
metadata = names(REDCapCAST::redcapcast_meta),
|
||||||
convert.logicals = TRUE
|
convert.logicals = TRUE
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ or attribute `factor.labels.attr` for haven_labelled data set (imported .dta
|
|||||||
file with `haven::read_dta()`).}
|
file with `haven::read_dta()`).}
|
||||||
|
|
||||||
\item{metadata}{redcap metadata headings. Default is
|
\item{metadata}{redcap metadata headings. Default is
|
||||||
REDCapCAST::redcap_meta_default().}
|
names(REDCapCAST::redcapcast_meta).}
|
||||||
|
|
||||||
\item{convert.logicals}{convert logicals to factor. Default is TRUE.}
|
\item{convert.logicals}{convert logicals to factor. Default is TRUE.}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user