Compare commits

..

2 Commits

6 changed files with 94 additions and 4 deletions

View File

@ -33,11 +33,12 @@ Suggests:
usethis, usethis,
ggplot2, ggplot2,
haven, haven,
here here,
styler
License: GPL (>= 3) License: GPL (>= 3)
Encoding: UTF-8 Encoding: UTF-8
LazyData: true LazyData: true
RoxygenNote: 7.2.3 RoxygenNote: 7.3.0
URL: https://github.com/agdamsbo/REDCapCAST, https://agdamsbo.github.io/REDCapCAST/ URL: https://github.com/agdamsbo/REDCapCAST, https://agdamsbo.github.io/REDCapCAST/
BugReports: https://github.com/agdamsbo/REDCapCAST/issues BugReports: https://github.com/agdamsbo/REDCapCAST/issues
Imports: Imports:
@ -56,6 +57,7 @@ Collate:
'ds2dd.R' 'ds2dd.R'
'ds2dd_detailed.R' 'ds2dd_detailed.R'
'easy_redcap.R' 'easy_redcap.R'
'read_redcap_instrument.R'
'read_redcap_tables.R' 'read_redcap_tables.R'
'redcap_wider.R' 'redcap_wider.R'
'redcapcast_data.R' 'redcapcast_data.R'

View File

@ -10,6 +10,7 @@ export(focused_metadata)
export(get_api_key) export(get_api_key)
export(guess_time_only_filter) export(guess_time_only_filter)
export(match_fields_to_form) export(match_fields_to_form)
export(read_redcap_instrument)
export(read_redcap_tables) export(read_redcap_tables)
export(redcap_wider) export(redcap_wider)
export(sanitize_split) export(sanitize_split)

View File

@ -6,10 +6,19 @@
* NEW: `ds2dd_detailed()`: extension of the `ds2dd()`, which serves to preserve as much metadata as possible automatically. Depends on a group of helper functions also introduced. Of special note is the `guess_time_only_filter()`, which will try to guess which columns/variables should be formatted as time only formats. Supports hms time format. DETAILED INSTRUCTION AND VIGNETTE IS PENDING. * NEW: `ds2dd_detailed()`: extension of the `ds2dd()`, which serves to preserve as much metadata as possible automatically. Depends on a group of helper functions also introduced. Of special note is the `guess_time_only_filter()`, which will try to guess which columns/variables should be formatted as time only formats. Supports hms time format. DETAILED INSTRUCTION AND VIGNETTE IS PENDING.
* NEW: `read_redcap_instrument()` convenience function to retrieve complete instrument. Goes a little against the focused approach. DETAILED INSTRUCTION IS PENDING.
### Other ### Other
I believe `renv` has now been added and runs correctly. After clone, do `renv::restore()` to install all necessary package to modify the package. I believe `renv` has now been added and runs correctly. After clone, do `renv::restore()` to install all necessary package to modify the package.
### Whishes before CRAN release
* Vignette for `ds2dd_detailed()`
* Tests for `ds2dd_detailed()`
# REDCapCAST 24.1.1 # REDCapCAST 24.1.1
### Functions ### Functions

View File

@ -0,0 +1,25 @@
#' Convenience function to download complete instrument, using token storage in keyring.
#'
#' @param key key name in standard keyring for token retrieval.
#' @param uri redcap api url
#' @param instrument instrument name
#' @param raw_or_label raw or label passed to `REDCapR::redcap_read()`
#' @param id_name id variable name. Default is "record_id".
#' @param records specify the records to download. Index numbers. Numeric vector.
#'
#' @return data.frame
#' @export
read_redcap_instrument <- function(key,
uri,
instrument = "rbans",
raw_or_label = "raw",
id_name = "record_id",
records = NULL) {
REDCapCAST::read_redcap_tables(
records = records,
uri = uri, token = keyring::key_get(key),
fields = id_name,
forms = instrument,
raw_or_label = raw_or_label
)[[{{ instrument }}]]
}

View File

@ -3,41 +3,60 @@ CMD
Codecov Codecov
DOI DOI
DataDictionary DataDictionary
Dependens
GStat GStat
GithubActions GithubActions
JSON JSON
Lifecycle Lifecycle
METACRAN METACRAN
POSIXct
Pivotting Pivotting
README README
REDCap REDCap
REDCapR REDCapR
REDCapRITS REDCapRITS
Whishes
al al
api api
attr
da da
dafault
datetime
demonstrational demonstrational
descirption descirption
desireable desireable
dmy
doi doi
dplyr dplyr
ds ds
dta
et et
gues
hms
immprovements immprovements
jbi jbi
keyring keyring
labelled
labelling
mRS mRS
matadata matadata
md md
nad mdy
natively
ncol
og og
param param
pegeler pegeler
perl perl
redcapcast pos
readr
sel
stRoke stRoke
stata
strsplit strsplit
thorugh thorugh
tibble tibble
tidyverse tidyverse
uri uri
wil
ymd

View File

@ -0,0 +1,34 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/read_redcap_instrument.R
\name{read_redcap_instrument}
\alias{read_redcap_instrument}
\title{Convenience function to download complete instrument, using token storage in keyring.}
\usage{
read_redcap_instrument(
key,
uri,
instrument = "rbans",
raw_or_label = "raw",
id_name = "record_id",
records = NULL
)
}
\arguments{
\item{key}{key name in standard keyring for token retrieval.}
\item{uri}{redcap api url}
\item{instrument}{instrument name}
\item{raw_or_label}{raw or label passed to `REDCapR::redcap_read()`}
\item{id_name}{id variable name. Default is "record_id".}
\item{records}{specify the records to download. Index numbers. Numeric vector.}
}
\value{
data.frame
}
\description{
Convenience function to download complete instrument, using token storage in keyring.
}