Compare commits

...

2 Commits

6 changed files with 94 additions and 4 deletions

View File

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

View File

@ -10,6 +10,7 @@ export(focused_metadata)
export(get_api_key)
export(guess_time_only_filter)
export(match_fields_to_form)
export(read_redcap_instrument)
export(read_redcap_tables)
export(redcap_wider)
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: `read_redcap_instrument()` convenience function to retrieve complete instrument. Goes a little against the focused approach. DETAILED INSTRUCTION IS PENDING.
### 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.
### Whishes before CRAN release
* Vignette for `ds2dd_detailed()`
* Tests for `ds2dd_detailed()`
# REDCapCAST 24.1.1
### 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
DOI
DataDictionary
Dependens
GStat
GithubActions
JSON
Lifecycle
METACRAN
POSIXct
Pivotting
README
REDCap
REDCapR
REDCapRITS
Whishes
al
api
attr
da
dafault
datetime
demonstrational
descirption
desireable
dmy
doi
dplyr
ds
dta
et
gues
hms
immprovements
jbi
keyring
labelled
labelling
mRS
matadata
md
nad
mdy
natively
ncol
og
param
pegeler
perl
redcapcast
pos
readr
sel
stRoke
stata
strsplit
thorugh
tibble
tidyverse
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.
}