mirror of
https://github.com/agdamsbo/REDCapCAST.git
synced 2024-11-24 05:51:55 +01:00
Compare commits
No commits in common. "6abee8f78ee81a4a4201ca582e74783388286db6" and "e26efd01b4b8cb25860912571bf2535e9ff6bcbd" have entirely different histories.
6abee8f78e
...
e26efd01b4
@ -6,7 +6,7 @@ options(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# source("renv/activate.R")
|
source("renv/activate.R")
|
||||||
|
|
||||||
if (interactive()) {
|
if (interactive()) {
|
||||||
suppressMessages(require(usethis))
|
suppressMessages(require(usethis))
|
||||||
|
14
.github/FUNDING.yml
vendored
14
.github/FUNDING.yml
vendored
@ -1,14 +0,0 @@
|
|||||||
# These are supported funding model platforms
|
|
||||||
|
|
||||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
|
||||||
patreon: # Replace with a single Patreon username
|
|
||||||
open_collective: # Replace with a single Open Collective username
|
|
||||||
ko_fi: # Replace with a single Ko-fi username
|
|
||||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
|
||||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
|
||||||
liberapay: agdamsbo
|
|
||||||
issuehunt: # Replace with a single IssueHunt username
|
|
||||||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
|
||||||
polar: # Replace with a single Polar username
|
|
||||||
buy_me_a_coffee: agdamsbo
|
|
||||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
|
2
.github/workflows/R-CMD-check.yaml
vendored
2
.github/workflows/R-CMD-check.yaml
vendored
@ -39,7 +39,7 @@ jobs:
|
|||||||
http-user-agent: ${{ matrix.config.http-user-agent }}
|
http-user-agent: ${{ matrix.config.http-user-agent }}
|
||||||
use-public-rspm: true
|
use-public-rspm: true
|
||||||
|
|
||||||
# - uses: r-lib/actions/setup-renv@v2
|
- uses: r-lib/actions/setup-renv@v2
|
||||||
|
|
||||||
- uses: r-lib/actions/setup-r-dependencies@v2
|
- uses: r-lib/actions/setup-r-dependencies@v2
|
||||||
with:
|
with:
|
||||||
|
2
.github/workflows/pkgdown.yaml
vendored
2
.github/workflows/pkgdown.yaml
vendored
@ -30,7 +30,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
use-public-rspm: true
|
use-public-rspm: true
|
||||||
|
|
||||||
# - uses: r-lib/actions/setup-renv@v2
|
- uses: r-lib/actions/setup-renv@v2
|
||||||
|
|
||||||
- uses: r-lib/actions/setup-r-dependencies@v2
|
- uses: r-lib/actions/setup-r-dependencies@v2
|
||||||
with:
|
with:
|
||||||
|
2
.github/workflows/test-coverage.yaml
vendored
2
.github/workflows/test-coverage.yaml
vendored
@ -21,7 +21,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
use-public-rspm: true
|
use-public-rspm: true
|
||||||
|
|
||||||
# - uses: r-lib/actions/setup-renv@v2
|
- uses: r-lib/actions/setup-renv@v2
|
||||||
|
|
||||||
- uses: r-lib/actions/setup-r-dependencies@v2
|
- uses: r-lib/actions/setup-r-dependencies@v2
|
||||||
with:
|
with:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
Package: REDCapCAST
|
Package: REDCapCAST
|
||||||
Title: REDCap Castellated Data Handling
|
Title: REDCap Castellated Data Handling
|
||||||
Version: 24.6.1
|
Version: 24.5.1
|
||||||
Authors@R: c(
|
Authors@R: c(
|
||||||
person("Andreas Gammelgaard", "Damsbo", email = "agdamsbo@clin.au.dk",
|
person("Andreas Gammelgaard", "Damsbo", email = "agdamsbo@clin.au.dk",
|
||||||
role = c("aut", "cre"),comment = c(ORCID = "0000-0002-7559-1154")),
|
role = c("aut", "cre"),comment = c(ORCID = "0000-0002-7559-1154")),
|
||||||
|
5
NEWS.md
5
NEWS.md
@ -1,4 +1,4 @@
|
|||||||
# REDCapCAST 24.6.1
|
# REDCapCAST 24.5.1
|
||||||
|
|
||||||
### Functions
|
### Functions
|
||||||
|
|
||||||
@ -13,7 +13,8 @@
|
|||||||
|
|
||||||
### Documentation and more
|
### Documentation and more
|
||||||
|
|
||||||
* Dependencies: In order to deploy `shiny_cast()` with `shinylive`, I need to remove `curl` as a dependency. To accomplish this, the `shiny_deploy()` helper functions has been moved to the package [`pacakge.aid`](https://github.com/agdamsbo/package.aid). This was before realising that `REDCapR` has `curl` as dependency, which is the culprit. `REDCapCAST` is not going to be a `shinylive` web-app without removing `REDCapR` dependency or any other REDCap database interaction, which would defy the purpose. I'll stick to hosted Shiny app instead.
|
* Dependencies: In order to deploy `shiny_cast()` with `shinylive`, I need to remove `curl` as a dependency. To accomplish this, the `shiny_deploy()` helper functions has been moved to the package [`pacakge.aid`](https://github.com/agdamsbo/package.aid). This was before realising that `REDCapR` has `curl` as dependency, which is the culprit. `REDCapCAST` is not going to be a `shinylive` web-app without removing `REDCapR` dependency, which in the app is used for easy data upload and data dictionary deployment.
|
||||||
|
|
||||||
|
|
||||||
# REDCapCAST 24.2.1
|
# REDCapCAST 24.2.1
|
||||||
|
|
||||||
|
25
R/doc2dd.R
25
R/doc2dd.R
@ -108,9 +108,6 @@ doc2dd <- function(data,
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Defining the calculations
|
## Defining the calculations
|
||||||
if (is_missing(col.calculation)) {
|
if (is_missing(col.calculation)) {
|
||||||
out <- out |>
|
out <- out |>
|
||||||
@ -118,13 +115,12 @@ doc2dd <- function(data,
|
|||||||
calculations = missing.default
|
calculations = missing.default
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
# With inspiration from textclean package, curly apostrophe is replaced
|
|
||||||
out <- out |>
|
out <- out |>
|
||||||
dplyr::mutate(
|
dplyr::mutate(
|
||||||
calculations = dplyr::pick(col.calculation) |>
|
calculations = dplyr::pick(col.calculation) |>
|
||||||
unlist() |>
|
unlist() |>
|
||||||
tolower() |>
|
tolower() |>
|
||||||
replace_curly_quote()
|
(\(.x) gsub("’", "'", .x))()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,22 +288,3 @@ is_missing <- function(data,nas=c("", "NA")) {
|
|||||||
is.na(data) | data %in% nas
|
is.na(data) | data %in% nas
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#' Replace curly apostrophes and quotes from word
|
|
||||||
#'
|
|
||||||
#' @description
|
|
||||||
#' Copied from textclean, which has not been updated since 2018 and is not
|
|
||||||
#' on CRAN. Github:https://github.com/trinker/textclean
|
|
||||||
#'
|
|
||||||
#' @param x character vector
|
|
||||||
#'
|
|
||||||
#' @return character vector
|
|
||||||
replace_curly_quote <- function(x){
|
|
||||||
replaces <- c('\x91', '\x92', '\x93', '\x94')
|
|
||||||
Encoding(replaces) <- "latin1"
|
|
||||||
for (i in 1:4) {
|
|
||||||
x <- gsub(replaces[i], c("'", "'", "\"", "\"")[i], x, fixed = TRUE)
|
|
||||||
}
|
|
||||||
x
|
|
||||||
}
|
|
||||||
|
@ -343,10 +343,10 @@ ds2dd_detailed <- function(data,
|
|||||||
lapply(function(x) {
|
lapply(function(x) {
|
||||||
if (is.factor(x)) {
|
if (is.factor(x)) {
|
||||||
## Re-factors to avoid confusion with missing levels
|
## Re-factors to avoid confusion with missing levels
|
||||||
## Assumes all relevant levels are represented in the data
|
## Assumes alle relevant levels are represented in the data
|
||||||
re_fac <- factor(x)
|
re_fac <- factor(x)
|
||||||
paste(
|
paste(
|
||||||
paste(seq_along(levels(re_fac)),
|
paste(unique(as.numeric(re_fac)),
|
||||||
levels(re_fac),
|
levels(re_fac),
|
||||||
sep = ", "
|
sep = ", "
|
||||||
),
|
),
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
[![GitHub R package version](https://img.shields.io/github/r-package/v/agdamsbo/REDCapCAST)](https://github.com/agdamsbo/REDCapCAST)
|
[![GitHub R package version](https://img.shields.io/github/r-package/v/agdamsbo/REDCapCAST)](https://github.com/agdamsbo/REDCapCAST)
|
||||||
[![CRAN/METACRAN](https://img.shields.io/cran/v/REDCapCAST)](https://CRAN.R-project.org/package=REDCapCAST)
|
[![CRAN/METACRAN](https://img.shields.io/cran/v/REDCapCAST)](https://CRAN.R-project.org/package=REDCapCAST)
|
||||||
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.8013984.svg)](https://doi.org/10.5281/zenodo.8013984)
|
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.8013984.svg)](https://doi.org/10.5281/zenodo.8013984)
|
||||||
[![R-hub](https://github.com/agdamsbo/REDCapCAST/actions/workflows/rhub.yaml/badge.svg)](https://github.com/agdamsbo/REDCapCAST/actions/workflows/rhub.yaml)
|
|
||||||
[![R-CMD-check](https://github.com/agdamsbo/REDCapCAST/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/agdamsbo/REDCapCAST/actions/workflows/R-CMD-check.yaml)
|
[![R-CMD-check](https://github.com/agdamsbo/REDCapCAST/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/agdamsbo/REDCapCAST/actions/workflows/R-CMD-check.yaml)
|
||||||
[![Page deployed](https://github.com/agdamsbo/REDCapCAST/actions/workflows/pages/pages-build-deployment/badge.svg)](https://github.com/agdamsbo/REDCapCAST/actions/workflows/pages/pages-build-deployment)
|
[![Page deployed](https://github.com/agdamsbo/REDCapCAST/actions/workflows/pages/pages-build-deployment/badge.svg)](https://github.com/agdamsbo/REDCapCAST/actions/workflows/pages/pages-build-deployment)
|
||||||
[![Codecov test coverage](https://codecov.io/gh/agdamsbo/REDCapCAST/branch/master/graph/badge.svg)](https://app.codecov.io/gh/agdamsbo/REDCapCAST?branch=master)
|
[![Codecov test coverage](https://codecov.io/gh/agdamsbo/REDCapCAST/branch/master/graph/badge.svg)](https://app.codecov.io/gh/agdamsbo/REDCapCAST?branch=master)
|
||||||
@ -35,9 +34,7 @@ Here is just a short description of the main functions:
|
|||||||
|
|
||||||
* `ds2dd_detailed()`: Converts a data set to a data dictionary for upload to a new REDCap database. Variables (fields) and instruments in a REDCap data base are defined by this data dictionary.
|
* `ds2dd_detailed()`: Converts a data set to a data dictionary for upload to a new REDCap database. Variables (fields) and instruments in a REDCap data base are defined by this data dictionary.
|
||||||
|
|
||||||
* `doc2dd()`: Converts a document table to data dictionary. This allows to specify instrument or whole data dictionary in text document, which for most is easier to work with and easily modifiable. Very much like a easy version of just working directly in the data dictionary file itself.
|
* `shiny_cast()`: [Shiny](https://www.rstudio.com/products/shiny/) application to ease the process of converting a spreadsheet/data set to a REDCap database. The app runs locally and data is transferred securely. You can just create and upload the data dictionary, but you can also transfer the given data in the same process. The app is [hosted on shinyapps.io](https://agdamsbo.shinyapps.io/redcapcast/) while I work on a [shinylive](https://posit-dev.github.io/r-shinylive/) implementation.
|
||||||
|
|
||||||
* `shiny_cast()`: [Shiny](https://www.rstudio.com/products/shiny/) application to ease the process of converting a spreadsheet/data set to a REDCap database. The app runs locally and data is transferred securely. You can just create and upload the data dictionary, but you can also transfer the given data in the same process. The app is [hosted on shinyapps.io](https://agdamsbo.shinyapps.io/redcapcast/) ~~while I work on a [shinylive](https://posit-dev.github.io/r-shinylive/) implementation~~.
|
|
||||||
|
|
||||||
## Future
|
## Future
|
||||||
|
|
||||||
@ -54,7 +51,7 @@ install.packages("REDCapCAST")
|
|||||||
Install the latest version directly from GitHub:
|
Install the latest version directly from GitHub:
|
||||||
|
|
||||||
```
|
```
|
||||||
pak::pak("agdamsbo/REDCapCAST")
|
remotes::install_github("agdamsbo/REDCapCAST")
|
||||||
```
|
```
|
||||||
|
|
||||||
## Code of Conduct
|
## Code of Conduct
|
||||||
|
10
app/rsconnect/shinyapps.io/agdamsbo/redcapcast.dcf
Normal file
10
app/rsconnect/shinyapps.io/agdamsbo/redcapcast.dcf
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
name: redcapcast
|
||||||
|
title:
|
||||||
|
username: agdamsbo
|
||||||
|
account: agdamsbo
|
||||||
|
server: shinyapps.io
|
||||||
|
hostUrl: https://api.shinyapps.io/v1
|
||||||
|
appId: 11351429
|
||||||
|
bundleId:
|
||||||
|
url: https://agdamsbo.shinyapps.io/redcapcast/
|
||||||
|
version: 1
|
10
app/rsconnect/shinyapps.io/cognitiveindex/shiny_cast.dcf
Normal file
10
app/rsconnect/shinyapps.io/cognitiveindex/shiny_cast.dcf
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
name: shiny_cast
|
||||||
|
title:
|
||||||
|
username: cognitiveindex
|
||||||
|
account: cognitiveindex
|
||||||
|
server: shinyapps.io
|
||||||
|
hostUrl: https://api.shinyapps.io/v1
|
||||||
|
appId: 11351378
|
||||||
|
bundleId: 8306502
|
||||||
|
url: https://cognitiveindex.shinyapps.io/shiny_cast/
|
||||||
|
version: 1
|
51
app/ui.R
51
app/ui.R
@ -1,6 +1,6 @@
|
|||||||
ui <- shiny::shinyUI(
|
ui <- shiny::shinyUI(
|
||||||
shiny::fluidPage(
|
shiny::fluidPage(
|
||||||
theme = shinythemes::shinytheme("flatly"),
|
theme = shinythemes::shinytheme("united"),
|
||||||
|
|
||||||
## -----------------------------------------------------------------------------
|
## -----------------------------------------------------------------------------
|
||||||
## Application title
|
## Application title
|
||||||
@ -11,20 +11,15 @@ ui <- shiny::shinyUI(
|
|||||||
# windowTitle = "REDCap database creator"
|
# windowTitle = "REDCap database creator"
|
||||||
# ),
|
# ),
|
||||||
|
|
||||||
shiny::titlePanel(
|
shiny::titlePanel(title = shiny::div(shiny::a(shiny::img(src="logo.png"),href="https://agdamsbo.github.io/REDCapCAST"),
|
||||||
title = shiny::div(
|
"Easy REDCap database creation"),
|
||||||
shiny::a(shiny::img(src = "logo.png"), href = "https://agdamsbo.github.io/REDCapCAST"),
|
|
||||||
"Easy REDCap database creation"
|
|
||||||
),
|
|
||||||
windowTitle = "REDCap database creator"
|
windowTitle = "REDCap database creator"
|
||||||
),
|
),
|
||||||
shiny::h4(
|
shiny::h4("This tool includes to convenient functions:",
|
||||||
"This tool includes to convenient functions:",
|
shiny::br(),
|
||||||
shiny::br(),
|
"1) creating a REDCap data dictionary based on a spreadsheet (.csv/.xls(x)/.dta) and",
|
||||||
"1) creating a REDCap data dictionary based on a spreadsheet (.csv/.xls(x)/.dta/.ods) and",
|
shiny::br(),
|
||||||
shiny::br(),
|
"2) creating said database on a given REDCap server and uploading the dataset via API access."),
|
||||||
"2) creating said database on a given REDCap server and uploading the dataset via API access."
|
|
||||||
),
|
|
||||||
|
|
||||||
|
|
||||||
## -----------------------------------------------------------------------------
|
## -----------------------------------------------------------------------------
|
||||||
@ -39,8 +34,7 @@ ui <- shiny::shinyUI(
|
|||||||
".csv",
|
".csv",
|
||||||
".xls",
|
".xls",
|
||||||
".xlsx",
|
".xlsx",
|
||||||
".dta",
|
".dta"
|
||||||
".ods"
|
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
shiny::h6("Below you can download the dataset formatted for upload and the
|
shiny::h6("Below you can download the dataset formatted for upload and the
|
||||||
@ -66,7 +60,7 @@ ui <- shiny::shinyUI(
|
|||||||
label = "API key",
|
label = "API key",
|
||||||
value = ""
|
value = ""
|
||||||
),
|
),
|
||||||
shiny::h6("An API key is an access key to the REDCap database. Please", shiny::a("see here for directions", href = "https://www.iths.org/news/redcap-tip/redcap-api-101/"), " to obtain an API key for your project."),
|
shiny::h6("An API key is an access key to the REDCap database. Please", shiny::a("see here for directions", href="https://www.iths.org/news/redcap-tip/redcap-api-101/"), " to obtain an API key for your project."),
|
||||||
shiny::actionButton(
|
shiny::actionButton(
|
||||||
inputId = "upload.meta",
|
inputId = "upload.meta",
|
||||||
label = "Upload datadictionary", icon = shiny::icon("book-bookmark")
|
label = "Upload datadictionary", icon = shiny::icon("book-bookmark")
|
||||||
@ -116,17 +110,17 @@ ui <- shiny::shinyUI(
|
|||||||
shiny::br(),
|
shiny::br(),
|
||||||
shiny::hr(),
|
shiny::hr(),
|
||||||
shiny::tags$footer(shiny::strong("Disclaimer: "),
|
shiny::tags$footer(shiny::strong("Disclaimer: "),
|
||||||
"This tool is aimed at demonstrating use of REDCapCAST. The app can be run locally or on a hosted server (will save no data anywhere). No responsibility for data loss or any other problems will be taken. Please contact me for support.",
|
"This tool is aimed at demonstrating use of REDCapCAST. No responsibility for data loss or any other problems will be taken. Please contact me for support.",
|
||||||
shiny::br(),
|
shiny::br(),
|
||||||
shiny::a("License: GPL-3+", href = "https://agdamsbo.github.io/REDCapCAST/LICENSE.html"),
|
shiny::a("License: GPL-3+",href="https://agdamsbo.github.io/REDCapCAST/LICENSE.html"),
|
||||||
"|",
|
"|",
|
||||||
shiny::a("agdamsbo/REDCapCAST", href = "https://agdamsbo.github.io/REDCapCAST"),
|
shiny::a("agdamsbo/REDCapCAST",href="https://agdamsbo.github.io/REDCapCAST"),
|
||||||
"|",
|
"|",
|
||||||
shiny::a("Source", href = "https://github.com/agdamsbo/REDCapCAST"),
|
shiny::a("Source",href="https://github.com/agdamsbo/REDCapCAST"),
|
||||||
"|",
|
"|",
|
||||||
shiny::a("Contact", href = "https://andreas.gdamsbo.dk"),
|
shiny::a("Contact",href="https://andreas.gdamsbo.dk"),
|
||||||
align = "center",
|
align = "center",
|
||||||
style = "
|
style = "
|
||||||
position:fixed;
|
position:fixed;
|
||||||
bottom:40px;
|
bottom:40px;
|
||||||
width:100%;
|
width:100%;
|
||||||
@ -135,7 +129,6 @@ ui <- shiny::shinyUI(
|
|||||||
padding: 0px;
|
padding: 0px;
|
||||||
background-color: White;
|
background-color: White;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
"
|
")
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -1,2 +1,20 @@
|
|||||||
## Test environments
|
## Test environments
|
||||||
New Rhubv2 implemented and tested with GitHub actions. All passed.
|
- R-hub windows-x86_64-devel (r-devel)
|
||||||
|
- R-hub ubuntu-gcc-release (r-release)
|
||||||
|
- R-hub fedora-clang-devel (r-devel)
|
||||||
|
|
||||||
|
## R CMD check results
|
||||||
|
❯ On windows-x86_64-devel (r-devel)
|
||||||
|
checking for non-standard things in the check directory ... NOTE
|
||||||
|
Found the following files/directories:
|
||||||
|
''NULL''
|
||||||
|
|
||||||
|
❯ On windows-x86_64-devel (r-devel)
|
||||||
|
checking for detritus in the temp directory ... NOTE
|
||||||
|
'lastMiKTeXException'
|
||||||
|
|
||||||
|
❯ On ubuntu-gcc-release (r-release), fedora-clang-devel (r-devel)
|
||||||
|
checking HTML version of manual ... NOTE
|
||||||
|
Skipping checking HTML validation: no command 'tidy' found
|
||||||
|
|
||||||
|
0 errors ✔ | 0 warnings ✔ | 3 notes ✖
|
||||||
|
@ -4,7 +4,6 @@ Codecov
|
|||||||
DOI
|
DOI
|
||||||
DataDictionary
|
DataDictionary
|
||||||
GStat
|
GStat
|
||||||
Github
|
|
||||||
GithubActions
|
GithubActions
|
||||||
JSON
|
JSON
|
||||||
Lifecycle
|
Lifecycle
|
||||||
@ -15,6 +14,7 @@ README
|
|||||||
REDCap
|
REDCap
|
||||||
REDCapR
|
REDCapR
|
||||||
REDCapRITS
|
REDCapRITS
|
||||||
|
THe
|
||||||
UI
|
UI
|
||||||
WD
|
WD
|
||||||
al
|
al
|
||||||
@ -34,10 +34,8 @@ dplyr
|
|||||||
ds
|
ds
|
||||||
dta
|
dta
|
||||||
et
|
et
|
||||||
github
|
|
||||||
gues
|
gues
|
||||||
hms
|
hms
|
||||||
https
|
|
||||||
immprovements
|
immprovements
|
||||||
io
|
io
|
||||||
jbi
|
jbi
|
||||||
@ -57,7 +55,6 @@ perl
|
|||||||
pos
|
pos
|
||||||
pre
|
pre
|
||||||
readr
|
readr
|
||||||
realising
|
|
||||||
sel
|
sel
|
||||||
sep
|
sep
|
||||||
seperator
|
seperator
|
||||||
@ -67,11 +64,9 @@ stRoke
|
|||||||
stata
|
stata
|
||||||
strsplit
|
strsplit
|
||||||
subheader
|
subheader
|
||||||
textclean
|
|
||||||
thorugh
|
thorugh
|
||||||
tibble
|
tibble
|
||||||
tidyverse
|
tidyverse
|
||||||
trinker
|
|
||||||
ui
|
ui
|
||||||
uri
|
uri
|
||||||
wil
|
wil
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
% Generated by roxygen2: do not edit by hand
|
|
||||||
% Please edit documentation in R/doc2dd.R
|
|
||||||
\name{replace_curly_quote}
|
|
||||||
\alias{replace_curly_quote}
|
|
||||||
\title{Replace curly apostrophes and quotes from word}
|
|
||||||
\usage{
|
|
||||||
replace_curly_quote(x)
|
|
||||||
}
|
|
||||||
\arguments{
|
|
||||||
\item{x}{character vector}
|
|
||||||
}
|
|
||||||
\value{
|
|
||||||
character vector
|
|
||||||
}
|
|
||||||
\description{
|
|
||||||
Copied from textclean, which has not been updated since 2018 and is not
|
|
||||||
on CRAN. Github:https://github.com/trinker/textclean
|
|
||||||
}
|
|
52
renv.lock
52
renv.lock
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"R": {
|
"R": {
|
||||||
"Version": "4.4.0",
|
"Version": "4.3.3",
|
||||||
"Repositories": [
|
"Repositories": [
|
||||||
{
|
{
|
||||||
"Name": "CRAN",
|
"Name": "CRAN",
|
||||||
@ -138,14 +138,14 @@
|
|||||||
},
|
},
|
||||||
"cachem": {
|
"cachem": {
|
||||||
"Package": "cachem",
|
"Package": "cachem",
|
||||||
"Version": "1.1.0",
|
"Version": "1.0.8",
|
||||||
"Source": "Repository",
|
"Source": "Repository",
|
||||||
"Repository": "CRAN",
|
"Repository": "CRAN",
|
||||||
"Requirements": [
|
"Requirements": [
|
||||||
"fastmap",
|
"fastmap",
|
||||||
"rlang"
|
"rlang"
|
||||||
],
|
],
|
||||||
"Hash": "cd9a672193789068eb5a2aad65a0dedf"
|
"Hash": "c35768291560ce302c0a6589f92e837d"
|
||||||
},
|
},
|
||||||
"cellranger": {
|
"cellranger": {
|
||||||
"Package": "cellranger",
|
"Package": "cellranger",
|
||||||
@ -199,6 +199,16 @@
|
|||||||
"Repository": "CRAN",
|
"Repository": "CRAN",
|
||||||
"Hash": "5d8225445acb167abf7797de48b2ee3c"
|
"Hash": "5d8225445acb167abf7797de48b2ee3c"
|
||||||
},
|
},
|
||||||
|
"cpp11": {
|
||||||
|
"Package": "cpp11",
|
||||||
|
"Version": "0.4.7",
|
||||||
|
"Source": "Repository",
|
||||||
|
"Repository": "CRAN",
|
||||||
|
"Requirements": [
|
||||||
|
"R"
|
||||||
|
],
|
||||||
|
"Hash": "5a295d7d963cc5035284dcdbaf334f4e"
|
||||||
|
},
|
||||||
"crayon": {
|
"crayon": {
|
||||||
"Package": "crayon",
|
"Package": "crayon",
|
||||||
"Version": "1.5.2",
|
"Version": "1.5.2",
|
||||||
@ -269,10 +279,10 @@
|
|||||||
},
|
},
|
||||||
"fastmap": {
|
"fastmap": {
|
||||||
"Package": "fastmap",
|
"Package": "fastmap",
|
||||||
"Version": "1.2.0",
|
"Version": "1.1.1",
|
||||||
"Source": "Repository",
|
"Source": "Repository",
|
||||||
"Repository": "CRAN",
|
"Repository": "CRAN",
|
||||||
"Hash": "aa5e1cd11c2d15497494c5292d7ffcc8"
|
"Hash": "f7736a18de97dea803bde0a2daaafb27"
|
||||||
},
|
},
|
||||||
"filelock": {
|
"filelock": {
|
||||||
"Package": "filelock",
|
"Package": "filelock",
|
||||||
@ -523,13 +533,13 @@
|
|||||||
},
|
},
|
||||||
"openssl": {
|
"openssl": {
|
||||||
"Package": "openssl",
|
"Package": "openssl",
|
||||||
"Version": "2.2.0",
|
"Version": "2.1.2",
|
||||||
"Source": "Repository",
|
"Source": "Repository",
|
||||||
"Repository": "CRAN",
|
"Repository": "CRAN",
|
||||||
"Requirements": [
|
"Requirements": [
|
||||||
"askpass"
|
"askpass"
|
||||||
],
|
],
|
||||||
"Hash": "2bcca3848e4734eb3b16103bc9aa4b8e"
|
"Hash": "ea2475b073243d9d338aa8f086ce973e"
|
||||||
},
|
},
|
||||||
"openxlsx2": {
|
"openxlsx2": {
|
||||||
"Package": "openxlsx2",
|
"Package": "openxlsx2",
|
||||||
@ -575,6 +585,30 @@
|
|||||||
],
|
],
|
||||||
"Hash": "01f28d4278f15c76cddbea05899c5d6f"
|
"Hash": "01f28d4278f15c76cddbea05899c5d6f"
|
||||||
},
|
},
|
||||||
|
"prettyunits": {
|
||||||
|
"Package": "prettyunits",
|
||||||
|
"Version": "1.2.0",
|
||||||
|
"Source": "Repository",
|
||||||
|
"Repository": "CRAN",
|
||||||
|
"Requirements": [
|
||||||
|
"R"
|
||||||
|
],
|
||||||
|
"Hash": "6b01fc98b1e86c4f705ce9dcfd2f57c7"
|
||||||
|
},
|
||||||
|
"progress": {
|
||||||
|
"Package": "progress",
|
||||||
|
"Version": "1.2.3",
|
||||||
|
"Source": "Repository",
|
||||||
|
"Repository": "CRAN",
|
||||||
|
"Requirements": [
|
||||||
|
"R",
|
||||||
|
"R6",
|
||||||
|
"crayon",
|
||||||
|
"hms",
|
||||||
|
"prettyunits"
|
||||||
|
],
|
||||||
|
"Hash": "f4625e061cb2865f111b47ff163a5ca6"
|
||||||
|
},
|
||||||
"promises": {
|
"promises": {
|
||||||
"Package": "promises",
|
"Package": "promises",
|
||||||
"Version": "1.3.0",
|
"Version": "1.3.0",
|
||||||
@ -751,7 +785,7 @@
|
|||||||
},
|
},
|
||||||
"stringi": {
|
"stringi": {
|
||||||
"Package": "stringi",
|
"Package": "stringi",
|
||||||
"Version": "1.8.4",
|
"Version": "1.8.3",
|
||||||
"Source": "Repository",
|
"Source": "Repository",
|
||||||
"Repository": "CRAN",
|
"Repository": "CRAN",
|
||||||
"Requirements": [
|
"Requirements": [
|
||||||
@ -760,7 +794,7 @@
|
|||||||
"tools",
|
"tools",
|
||||||
"utils"
|
"utils"
|
||||||
],
|
],
|
||||||
"Hash": "39e1144fd75428983dc3f63aa53dfa91"
|
"Hash": "058aebddea264f4c99401515182e656a"
|
||||||
},
|
},
|
||||||
"stringr": {
|
"stringr": {
|
||||||
"Package": "stringr",
|
"Package": "stringr",
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
|
|
||||||
R version 3.4.1 (2017-06-30) -- "Single Candle"
|
|
||||||
Copyright (C) 2017 The R Foundation for Statistical Computing
|
|
||||||
Platform: x86_64-apple-darwin15.6.0 (64-bit)
|
|
||||||
|
|
||||||
R is free software and comes with ABSOLUTELY NO WARRANTY.
|
|
||||||
You are welcome to redistribute it under certain conditions.
|
|
||||||
Type 'license()' or 'licence()' for distribution details.
|
|
||||||
|
|
||||||
R is a collaborative project with many contributors.
|
|
||||||
Type 'contributors()' for more information and
|
|
||||||
'citation()' on how to cite R or R packages in publications.
|
|
||||||
|
|
||||||
Type 'demo()' for some demos, 'help()' for on-line help, or
|
|
||||||
'help.start()' for an HTML browser interface to help.
|
|
||||||
Type 'q()' to quit R.
|
|
||||||
|
|
||||||
> if(requireNamespace('spelling', quietly = TRUE))
|
|
||||||
+ spelling::spell_check_test(vignettes = TRUE, error = FALSE,
|
|
||||||
+ skip_on_cran = TRUE)
|
|
||||||
All Done!
|
|
||||||
>
|
|
||||||
> proc.time()
|
|
||||||
user system elapsed
|
|
||||||
0.372 0.039 0.408
|
|
@ -1,5 +1,4 @@
|
|||||||
library(testthat)
|
library(testthat)
|
||||||
library(REDCapCAST)
|
library(REDCapCAST)
|
||||||
|
|
||||||
# testthat::test_dir(here::here("tests/testthat"))
|
|
||||||
test_check("REDCapCAST")
|
test_check("REDCapCAST")
|
||||||
|
@ -8,7 +8,5 @@
|
|||||||
|
|
||||||
# setwd("tests/testthat")
|
# setwd("tests/testthat")
|
||||||
|
|
||||||
get_data_location <- function(x){
|
get_data_location <- function(x)
|
||||||
# here::here(file.path("tests","testthat","data", x))
|
|
||||||
file.path("data", x)
|
file.path("data", x)
|
||||||
}
|
|
||||||
|
@ -18,59 +18,33 @@ knitr::opts_chunk$set(
|
|||||||
library(REDCapCAST)
|
library(REDCapCAST)
|
||||||
```
|
```
|
||||||
|
|
||||||
# Two different ways to create a data base
|
# Easy data set to data base workflow
|
||||||
|
|
||||||
`REDCapCAST` provides two approaches to creating a data dictionary aimed at helping out in two different cases:
|
THe first iteration of a dataset to data dictionary function is the `ds2dd()`, which creates a very basic data dictionary with all variables stored as text. This is sufficient for just storing old datasets/spreadsheets securely in REDCap.
|
||||||
|
|
||||||
1. Easily create a REDCap data base from an existing data set.
|
```{r eval=FALSE}
|
||||||
|
mtcars |>
|
||||||
2. Create a table in Word describing a variables in a data base and use this to create a data base.
|
|
||||||
|
|
||||||
In the following I will try to come with a few suggestions on how to use these approaches.
|
|
||||||
|
|
||||||
## Easy data set to data base workflow
|
|
||||||
|
|
||||||
The first iteration of a dataset to data dictionary function is the `ds2dd()`, which creates a very basic data dictionary with all variables stored as text. This is sufficient for just storing old datasets/spreadsheets securely in REDCap.
|
|
||||||
|
|
||||||
```{r eval=TRUE}
|
|
||||||
d1 <- mtcars |>
|
|
||||||
dplyr::mutate(record_id = seq_len(dplyr::n())) |>
|
dplyr::mutate(record_id = seq_len(dplyr::n())) |>
|
||||||
ds2dd()
|
ds2dd() |>
|
||||||
|
str()
|
||||||
d1 |>
|
|
||||||
gt::gt()
|
|
||||||
```
|
```
|
||||||
|
|
||||||
The more advanced `ds2dd_detailed()` is a natural development. It will try to apply the most common data classes for data validation and will assume that the first column is the id number. It outputs a list with the dataset with modified variable names to comply with REDCap naming conventions and a data dictionary.
|
The more advanced `ds2dd_detailed()` is a natural development. It will try to apply the most common data classes for data validation and will assume that the first column is the id number. It outputs a list with the dataset with modified variable names to comply with REDCap naming conventions and a data dictionary.
|
||||||
|
|
||||||
The dataset should be correctly formatted for the data dictionary to preserve as much information as possible.
|
The dataset should be correctly formatted for the data dictionary to preserve as much information as possible.
|
||||||
|
|
||||||
```{r eval=TRUE}
|
```{r eval=FALSE}
|
||||||
d2 <- REDCapCAST::redcapcast_data |>
|
dd_ls <- mtcars |>
|
||||||
dplyr::mutate(record_id = seq_len(dplyr::n()),
|
dplyr::mutate(record_id = seq_len(dplyr::n())) |>
|
||||||
region=factor(region)) |>
|
|
||||||
dplyr::select(record_id, dplyr::everything()) |>
|
dplyr::select(record_id, dplyr::everything()) |>
|
||||||
(\(.x){
|
ds2dd_detailed()
|
||||||
.x[!grepl("_complete$",names(.x))]
|
dd_ls |>
|
||||||
})() |>
|
str()
|
||||||
(\(.x){
|
|
||||||
.x[!grepl("^redcap",names(.x))]
|
|
||||||
})() |>
|
|
||||||
ds2dd_detailed() |>
|
|
||||||
purrr::pluck("meta")
|
|
||||||
|
|
||||||
d2 |>
|
|
||||||
gt::gt()
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Additional specifications to the DataDictionary can be made manually, or it can be uploaded and modified manually in the graphical user interface on the REDCap server.
|
Additional specifications to the DataDictionary can be made manually, or it can be uploaded and modified manually in the graphical user interface on the web page.
|
||||||
|
|
||||||
## Data base from table
|
## Step 3 - Meta data upload
|
||||||
|
|
||||||
...instructions and examples are coming...
|
|
||||||
|
|
||||||
|
|
||||||
## Meta data and data upload
|
|
||||||
|
|
||||||
Now the DataDictionary can be exported as a spreadsheet and uploaded or it can be uploaded using the `REDCapR` package (only projects with "Development" status).
|
Now the DataDictionary can be exported as a spreadsheet and uploaded or it can be uploaded using the `REDCapR` package (only projects with "Development" status).
|
||||||
|
|
||||||
|
@ -14,6 +14,10 @@ knitr::opts_chunk$set(
|
|||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```{r setup}
|
||||||
|
library(REDCapCAST)
|
||||||
|
```
|
||||||
|
|
||||||
To make the easiest possible transition from spreadsheet/dataset to REDCap, I have created a small Shiny app, which adds a graphical interface to the casting of a data dictionary and data upload. Install the package and run the app as follows:
|
To make the easiest possible transition from spreadsheet/dataset to REDCap, I have created a small Shiny app, which adds a graphical interface to the casting of a data dictionary and data upload. Install the package and run the app as follows:
|
||||||
|
|
||||||
```{r eval=FALSE}
|
```{r eval=FALSE}
|
||||||
|
Loading…
Reference in New Issue
Block a user