mirror of
https://github.com/agdamsbo/REDCapCAST.git
synced 2024-11-23 05:50:21 +01:00
cleaning
This commit is contained in:
parent
40d95e41c3
commit
ae1c120cd8
@ -50,7 +50,7 @@ file_extension <- function(filenames) {
|
||||
#' @examples
|
||||
#' read_input("https://raw.githubusercontent.com/agdamsbo/cognitive.index.lookup/main/data/sample.csv")
|
||||
read_input <- function(file, consider.na = c("NA", '""', "")) {
|
||||
ext <- tools::file_ext(file)
|
||||
ext <- tolower(tools::file_ext(file))
|
||||
|
||||
tryCatch(
|
||||
{
|
||||
@ -66,7 +66,7 @@ read_input <- function(file, consider.na = c("NA", '""', "")) {
|
||||
df <- readr::read_rds(file = file)
|
||||
}else {
|
||||
stop("Input file format has to be on of:
|
||||
'.csv', '.xls', '.xlsx', '.dta', '.rds' or '.ods'")
|
||||
'.csv', '.xls', '.xlsx', '.dta', '.ods' or '.rds'")
|
||||
}
|
||||
},
|
||||
error = function(e) {
|
||||
|
@ -12,6 +12,7 @@ GithubActions
|
||||
JSON
|
||||
Lifecycle
|
||||
METACRAN
|
||||
Nav
|
||||
ORCID
|
||||
POSIXct
|
||||
Pivotting
|
||||
@ -19,17 +20,22 @@ README
|
||||
REDCap
|
||||
REDCapR
|
||||
REDCapRITS
|
||||
REDCapTidieR
|
||||
WD
|
||||
al
|
||||
api
|
||||
attr
|
||||
calc
|
||||
capitalisation
|
||||
charater
|
||||
cond
|
||||
cpr
|
||||
da
|
||||
dafault
|
||||
datadictionary
|
||||
datetime
|
||||
demonstrational
|
||||
detatched
|
||||
dir
|
||||
dmy
|
||||
docx
|
||||
@ -38,6 +44,10 @@ dplyr
|
||||
ds
|
||||
dta
|
||||
et
|
||||
factorises
|
||||
factorising
|
||||
fct
|
||||
forcats
|
||||
github
|
||||
gues
|
||||
hms
|
||||
@ -50,7 +60,9 @@ mRS
|
||||
matadata
|
||||
md
|
||||
mdy
|
||||
mrs
|
||||
mtcars
|
||||
na
|
||||
natively
|
||||
ncol
|
||||
og
|
||||
@ -59,8 +71,10 @@ pegeler
|
||||
perl
|
||||
pos
|
||||
pre
|
||||
rds
|
||||
readr
|
||||
realising
|
||||
redcapAPI
|
||||
renv
|
||||
runApp
|
||||
sel
|
||||
@ -75,8 +89,12 @@ subheader
|
||||
textclean
|
||||
thorugh
|
||||
tibble
|
||||
tidyverse
|
||||
trinker
|
||||
truefalse
|
||||
ui
|
||||
un
|
||||
unlabelled
|
||||
uri
|
||||
vec
|
||||
wil
|
||||
ymd
|
||||
|
@ -5,6 +5,6 @@ account: agdamsbo
|
||||
server: shinyapps.io
|
||||
hostUrl: https://api.shinyapps.io/v1
|
||||
appId: 11351429
|
||||
bundleId: 9392352
|
||||
bundleId: 9396834
|
||||
url: https://agdamsbo.shinyapps.io/redcapcast/
|
||||
version: 1
|
||||
|
@ -17,21 +17,23 @@ server <- function(input, output, session) {
|
||||
file = NULL
|
||||
)
|
||||
|
||||
dat <- shiny::reactive({
|
||||
ds <- shiny::reactive({
|
||||
shiny::req(input$ds)
|
||||
|
||||
out <- read_input(input$ds$datapath)
|
||||
|
||||
# Saves labels to reapply later
|
||||
# labels <- lapply(out, get_attr)
|
||||
|
||||
out <- out |>
|
||||
## Parses data with readr functions
|
||||
parse_data() |>
|
||||
## Converts logical to factor, which overwrites attributes
|
||||
##
|
||||
## Converts logical to factor, preserving attributes with own function
|
||||
dplyr::mutate(dplyr::across(dplyr::where(is.logical), as_factor))
|
||||
|
||||
out
|
||||
})
|
||||
|
||||
dat <- shiny::reactive({
|
||||
out <- ds()
|
||||
|
||||
if (!is.null(input$factor_vars)) {
|
||||
out <- out |>
|
||||
dplyr::mutate(
|
||||
@ -42,12 +44,6 @@ server <- function(input, output, session) {
|
||||
)
|
||||
}
|
||||
|
||||
# Old attributes are appended
|
||||
# out <- purrr::imap(out,\(.x,.i){
|
||||
# set_attr(.x,labels[[.i]])
|
||||
# }) |>
|
||||
# dplyr::bind_cols()
|
||||
|
||||
out
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user