-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d74d94e
commit df779e2
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
estimates_dictionary_build <- function() { | ||
text <- | ||
'Model,Description,Package,Function | ||
lm,Linear Model, stats,lm | ||
logit,Logistic Regression,stats,glm | ||
probit,Probit Regression,stats,glm | ||
ologit,Ordered Logistic Regression,MASS,polr | ||
oprobit,Ordered Probit Regression,MASS,polr | ||
multinom,Multinomial Log-Linear,nnet,multinom' | ||
out <- utils::read.csv( | ||
text = text, | ||
colClasses = c("character", "character", "character", "character")) | ||
colnames(out) <- gsub("\\.$", "", colnames(out)) | ||
for (i in 1:4) { | ||
out[[i]] <- trimws(out[[i]]) | ||
} | ||
class(out) <- c("estimates_dictionary", "data.frame") | ||
return(out) | ||
} | ||
|
||
|
||
#' estimates dictionary | ||
#' | ||
#' @noRd | ||
estimates_dictionary <- estimates_dictionary_build() | ||
|
||
|
||
print.estimates_dictionary <- function(x, ...) { | ||
flag <- insight::check_if_installed("knitr", quietly = TRUE) | ||
if (isTRUE(flag)) { | ||
print(knitr::kable(x)) | ||
} else { | ||
print(x) | ||
} | ||
} | ||
|
||
|
||
estimates <- function(formula, data, model, ...) { | ||
if (missing(model)) { | ||
return(estimates_dictionary) | ||
} else { | ||
checkmate::assert_choice(model, estimates_dictionary$Model) | ||
} | ||
if (missing(formula)) { | ||
fun <- subset(estimates_dictionary, Model == model) | ||
fun <- sprintf("%s::%s", fun$Package, fun$Function) | ||
args <- names(as.list(args(eval(substitute(fun))))) | ||
msg <- pi | ||
insight::format_error(msg) | ||
|
||
if (missing(data) || !isTRUE(checkmate::check_data_frame(data, null.ok = FALSE))) { | ||
insight::format_error("blah blah") | ||
} | ||
} |