mirror of
https://github.com/agdamsbo/FreesearchR.git
synced 2025-12-15 17:12:09 +01:00
include correlation pair validation
This commit is contained in:
parent
136480ca3d
commit
b45a4d9003
1 changed files with 45 additions and 2 deletions
|
|
@ -215,6 +215,19 @@ missings_validate <- function(data){
|
|||
}
|
||||
}
|
||||
|
||||
corr_pairs_validate <- function(data){
|
||||
data_s <- if (shiny::is.reactive(data)) data() else data
|
||||
if (!0 %in% dim(data_s)) {
|
||||
# browser()
|
||||
n_pairs <- nrow(data_s)
|
||||
data.frame(
|
||||
n_pairs = n_pairs
|
||||
)
|
||||
} else {
|
||||
data.frame(NULL)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
########################################################################
|
||||
############# Collected validation functions in a library-like function
|
||||
|
|
@ -264,10 +277,10 @@ validation_lib <- function(name=NULL) {
|
|||
test.fun.args = list(var = "p_out", cut = 50)
|
||||
)
|
||||
},
|
||||
"missings" = function(x, y) {
|
||||
"missings" = function(x) {
|
||||
### Placeholder for missingness validation
|
||||
list(
|
||||
string = "There are {p_miss} % missing observations.",
|
||||
string = i18n$t("There are {p_miss} % missing observations."),
|
||||
summary.fun = missings_validate,
|
||||
summary.fun.args = list(
|
||||
data = x
|
||||
|
|
@ -278,6 +291,36 @@ validation_lib <- function(name=NULL) {
|
|||
},
|
||||
test.fun.args = list(var = "p_miss", cut = 30)
|
||||
)
|
||||
},
|
||||
# "mcar" = function(x) {
|
||||
# ### Placeholder for missingness validation
|
||||
# list(
|
||||
# string = i18n$t("There are {p_miss} % missing observations."),
|
||||
# summary.fun = missings_validate,
|
||||
# summary.fun.args = list(
|
||||
# data = x
|
||||
# ),
|
||||
# test.fun = function(x, var, cut) {
|
||||
# test.var <- x[var]
|
||||
# ifelse(test.var > cut, "warning", "succes")
|
||||
# },
|
||||
# test.fun.args = list(var = "p_miss", cut = 30)
|
||||
# )
|
||||
# },
|
||||
"corr_pairs" = function(x) {
|
||||
### Placeholder for missingness validation
|
||||
list(
|
||||
string = i18n$t("Data includes {n_pairs} pairs of highly correlated variables."),
|
||||
summary.fun = corr_pairs_validate,
|
||||
summary.fun.args = list(
|
||||
data = x
|
||||
),
|
||||
test.fun = function(x, var, cut) {
|
||||
test.var <- x[var]
|
||||
ifelse(test.var > cut, "warning", "succes")
|
||||
},
|
||||
test.fun.args = list(var = "n_pairs", cut = 0)
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue