mirror of
https://github.com/agdamsbo/REDCapCAST.git
synced 2026-06-19 05:07:30 +02:00
trying to overcome error messagein github actions by moving R package to root.
This commit is contained in:
parent
58cabc7153
commit
582a481942
33 changed files with 1 additions and 1276 deletions
41
R/process_user_input.r
Normal file
41
R/process_user_input.r
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
process_user_input <- function (x) {
|
||||
UseMethod("process_user_input", x)
|
||||
}
|
||||
|
||||
process_user_input.default <- function(x, ...) {
|
||||
stop(
|
||||
deparse(substitute(x)),
|
||||
" must be a 'data.frame',",
|
||||
" a 'response',",
|
||||
" or a 'character' vector containing JSON.",
|
||||
call. = FALSE
|
||||
)
|
||||
}
|
||||
|
||||
process_user_input.data.frame <- function(x, ...) {
|
||||
x
|
||||
}
|
||||
|
||||
process_user_input.character <- function(x, ...) {
|
||||
|
||||
if (!requireNamespace("jsonlite", quietly = TRUE)) {
|
||||
stop(
|
||||
"The package 'jsonlite' is needed to convert ",
|
||||
deparse(substitute(x)),
|
||||
" into a data frame.",
|
||||
"\n Either install 'jsonlite' or pass ",
|
||||
deparse(substitute(x)),
|
||||
" as a 'data.frame'.",
|
||||
call. = FALSE
|
||||
)
|
||||
}
|
||||
|
||||
jsonlite::fromJSON(x)
|
||||
|
||||
}
|
||||
|
||||
process_user_input.response <- function(x, ...) {
|
||||
|
||||
process_user_input(rawToChar(x$content))
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue