Skip to content

Commit

Permalink
use datawizard, remove importFrom tag
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Jun 18, 2021
1 parent 1d15441 commit 1d70ac7
Show file tree
Hide file tree
Showing 21 changed files with 5 additions and 101 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Imports:
insight (>= 0.14.1.1),
parameters (>= 0.14.0.1),
performance (>= 0.7.2),
datawizard,
stats,
tools,
utils
Expand Down
41 changes: 0 additions & 41 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -303,44 +303,3 @@ export(text_lastchar)
export(text_paste)
export(text_remove)
export(text_wrap)
importFrom(effectsize,effectsize)
importFrom(effectsize,interpret_bf)
importFrom(effectsize,interpret_d)
importFrom(effectsize,interpret_ess)
importFrom(effectsize,interpret_eta_squared)
importFrom(effectsize,interpret_oddsratio)
importFrom(effectsize,interpret_r)
importFrom(effectsize,interpret_rhat)
importFrom(effectsize,is_effectsize_name)
importFrom(insight,export_table)
importFrom(insight,find_algorithm)
importFrom(insight,find_variables)
importFrom(insight,format_bf)
importFrom(insight,format_ci)
importFrom(insight,format_number)
importFrom(insight,format_table)
importFrom(insight,format_value)
importFrom(insight,get_data)
importFrom(insight,is_nullmodel)
importFrom(insight,model_info)
importFrom(insight,print_colour)
importFrom(parameters,kurtosis)
importFrom(parameters,model_parameters)
importFrom(parameters,skewness)
importFrom(stats,aggregate)
importFrom(stats,contrasts)
importFrom(stats,mad)
importFrom(stats,median)
importFrom(stats,na.omit)
importFrom(stats,sd)
importFrom(stats,setNames)
importFrom(stats,var)
importFrom(stats,weighted.mean)
importFrom(stats,xtabs)
importFrom(tools,toTitleCase)
importFrom(utils,citation)
importFrom(utils,head)
importFrom(utils,modifyList)
importFrom(utils,packageVersion)
importFrom(utils,sessionInfo)
importFrom(utils,tail)
1 change: 0 additions & 1 deletion R/format_algorithm.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#' format_algorithm(model)
#' }
#' @return A character string.
#' @importFrom insight find_algorithm
#' @export
format_algorithm <- function(x) {
algorithm <- suppressWarnings(insight::find_algorithm(x))
Expand Down
1 change: 0 additions & 1 deletion R/format_formula.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#' format_formula(model)
#' format_formula(model, "random")
#' }
#' @importFrom insight find_algorithm
#' @export
format_formula <- function(x, what = "conditional") {
f <- .safe_deparse(insight::find_formula(x)[[what]])
Expand Down
1 change: 0 additions & 1 deletion R/format_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#' format_model(model)
#' }
#' @return A character string.
#' @importFrom insight model_info is_nullmodel
#' @export
format_model <- function(x) {
UseMethod("format_model")
Expand Down
5 changes: 2 additions & 3 deletions R/format_text.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,14 @@ text_lastchar <- function(text, n = 1) {


#' @rdname format_text
#' @importFrom utils head tail
#' @export
text_concatenate <- function(text, sep = ", ", last = " and ") {
text <- text[text != ""]
if (length(text) == 1) {
text
} else {
s <- paste0(head(text, -1), collapse = sep)
s <- paste0(c(s, tail(text, 1)), collapse = last)
s <- paste0(utils::head(text, -1), collapse = sep)
s <- paste0(c(s, utils::tail(text, 1)), collapse = last)
s
}
}
Expand Down
5 changes: 0 additions & 5 deletions R/report.aov.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ report.aovlist <- report.aov


#' @rdname report.aov
#' @importFrom effectsize effectsize interpret_eta_squared is_effectsize_name
#' @importFrom parameters model_parameters
#' @importFrom insight model_info
#' @export
report_effectsize.aov <- function(x, ...) {
table <- effectsize::effectsize(x, ...)
Expand Down Expand Up @@ -102,8 +99,6 @@ report_effectsize.aovlist <- report_effectsize.aov
# report_table ------------------------------------------------------------

#' @rdname report.aov
#' @importFrom parameters model_parameters
#' @importFrom insight model_info
#' @export
report_table.aov <- function(x, ...) {
effsize <- report_effectsize(x, ...)
Expand Down
6 changes: 0 additions & 6 deletions R/report.bayesfactor_models.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@
#' r
#' as.data.frame(r)
#' }
#' @importFrom effectsize interpret_bf
#' @importFrom stats setNames
#' @importFrom insight format_bf
#' @return An object of class \code{\link{report}}.
#' @export
report.bayesfactor_models <- function(x,
Expand Down Expand Up @@ -223,9 +220,6 @@ report_text.bayesfactor_models <- function(x,
# bayesfactor_inclusion ---------------------------------------------------

#' @rdname report.bayesfactor_models
#' @importFrom effectsize interpret_bf
#' @importFrom insight format_value
#' @importFrom stats setNames
#' @export
report.bayesfactor_inclusion <- function(x,
interpretation = "jeffreys1961",
Expand Down
2 changes: 0 additions & 2 deletions R/report.character.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#' @rdname report.data.frame
#' @importFrom parameters skewness kurtosis
#'
#' @export
report.character <- function(x,
n_entries = 3,
Expand Down
2 changes: 0 additions & 2 deletions R/report.factor.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#' @rdname report.data.frame
#' @importFrom parameters skewness kurtosis
#'
#' @export
report.factor <- function(x, levels_percentage = "auto", ...) {
table <- report_table(x, levels_percentage = levels_percentage, ...)
Expand Down
6 changes: 0 additions & 6 deletions R/report.htest.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#' report(t.test(mtcars$mpg ~ mtcars$vs))
#' report(t.test(mtcars$mpg, mtcars$vs, paired = TRUE))
#' report(t.test(iris$Sepal.Width, mu = 1))
#' @importFrom insight format_ci
#' @return An object of class \code{\link{report}}.
#' @export
report.htest <- function(x, ...) {
Expand All @@ -34,9 +33,6 @@ report.htest <- function(x, ...) {
# report_effectsize -------------------------------------------------------

#' @rdname report.htest
#' @importFrom effectsize effectsize interpret_r interpret_d
#' @importFrom parameters model_parameters
#' @importFrom insight model_info
#' @export
report_effectsize.htest <- function(x, ...) {
table <- effectsize::effectsize(x, verbose = FALSE, ...)
Expand Down Expand Up @@ -149,8 +145,6 @@ report_effectsize.htest <- function(x, ...) {


#' @rdname report.htest
#' @importFrom parameters model_parameters
#' @importFrom insight model_info
#' @export
report_table.htest <- function(x, ...) {
table_full <- parameters::model_parameters(x, ...)
Expand Down
5 changes: 0 additions & 5 deletions R/report.lm.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ report.lm <- function(x, include_effectsize = TRUE, effectsize_method = "refit",
# report_effectsize -------------------------------------------------------

#' @rdname report.lm
#' @importFrom effectsize effectsize is_effectsize_name interpret_d interpret_oddsratio
#' @importFrom parameters model_parameters
#' @importFrom insight model_info
#' @export

report_effectsize.lm <- function(x, effectsize_method = "refit", ...) {
Expand Down Expand Up @@ -133,8 +130,6 @@ report_effectsize.lm <- function(x, effectsize_method = "refit", ...) {


#' @rdname report.lm
#' @importFrom parameters model_parameters
#' @importFrom insight model_info
#' @include utils_combine_tables.R
#' @export
report_table.lm <- function(x, include_effectsize = TRUE, ...) {
Expand Down
7 changes: 2 additions & 5 deletions R/report.numeric.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#' @rdname report.data.frame
#' @importFrom stats mad sd median
#' @importFrom parameters skewness kurtosis
#'
#' @export
report.numeric <- function(x,
n = FALSE,
Expand Down Expand Up @@ -74,8 +71,8 @@ report_table.numeric <- function(x,
Min = min(x, na.rm = TRUE),
Max = max(x, na.rm = TRUE),
n_Obs = length(x),
Skewness = as.numeric(parameters::skewness(x, verbose = FALSE, ...)),
Kurtosis = as.numeric(parameters::kurtosis(x, verbose = FALSE, ...)),
Skewness = as.numeric(datawizard::skewness(x, verbose = FALSE, ...)),
Kurtosis = as.numeric(datawizard::kurtosis(x, verbose = FALSE, ...)),
n_Missing = sum(is.na(x))
)

Expand Down
5 changes: 0 additions & 5 deletions R/report.sessionInfo.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#' report_packages(include_R = FALSE)
#' cite_packages(prefix = "> ")
#' report_system()
#' @importFrom utils packageVersion sessionInfo
#' @return An object of class \code{\link{report}}.
#' @export
report.sessionInfo <- function(x, ...) {
Expand All @@ -41,7 +40,6 @@ report.sessionInfo <- function(x, ...) {
# Aliases -----------------------------------------------------------------


#' @importFrom utils sessionInfo
#' @rdname report.sessionInfo
#' @export
report_packages <- function(session = NULL, include_R = TRUE, ...) {
Expand All @@ -50,7 +48,6 @@ report_packages <- function(session = NULL, include_R = TRUE, ...) {
}


#' @importFrom utils sessionInfo
#' @rdname report.sessionInfo
#' @export
cite_packages <- function(session = NULL, include_R = TRUE, ...) {
Expand All @@ -73,7 +70,6 @@ cite_packages <- function(session = NULL, include_R = TRUE, ...) {
# report_system --------------------------------------------------------------


#' @importFrom utils sessionInfo citation
#' @rdname report.sessionInfo
#' @export
report_system <- function(session = NULL) {
Expand Down Expand Up @@ -110,7 +106,6 @@ report_system <- function(session = NULL) {

# report_table ------------------------------------------------------------

#' @importFrom utils citation packageVersion
#' @export
report_table.sessionInfo <- function(x, include_R = TRUE, ...) {
pkgs <- x$otherPkgs
Expand Down
2 changes: 0 additions & 2 deletions R/report_intercept.R
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ print.report_intercept <- function(x, ...) {

# Utils -------------------------------------------------------------------

#' @importFrom insight is_nullmodel get_data find_variables
#' @keywords internal
.find_intercept <- function(model) {

Expand Down Expand Up @@ -97,7 +96,6 @@ print.report_intercept <- function(x, ...) {



#' @importFrom stats contrasts
.find_reference_level <- function(f) {
tryCatch(
{
Expand Down
1 change: 0 additions & 1 deletion R/report_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ print.report_parameters <- function(x, ...) {



#' @importFrom effectsize interpret_rhat interpret_ess
#' @keywords internal
.parameters_diagnostic_bayesian <- function(diagnostic, only_when_insufficient = FALSE, ...) {

Expand Down
4 changes: 0 additions & 4 deletions R/report_participants.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
#' report_participants(data, participants = "Participant", spell_n = TRUE),
#' "were recruited in the study by means of torture and coercion."
#' )
#' @importFrom stats aggregate
#' @export
report_participants <- function(data,
age = NULL,
Expand Down Expand Up @@ -134,9 +133,6 @@ report_participants <- function(data,



#' @importFrom stats aggregate
#' @importFrom insight format_number format_value
#' @importFrom tools toTitleCase
#' @keywords internal
.report_participants <- function(data,
age = "Age",
Expand Down
7 changes: 0 additions & 7 deletions R/report_sample.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#' report_sample(iris[, 1:4])
#' report_sample(iris, select = c("Sepal.Length", "Petal.Length", "Species"))
#' report_sample(iris, group_by = "Species")
#' @importFrom stats median sd mad
#' @export
report_sample <- function(data,
group_by = NULL,
Expand Down Expand Up @@ -161,7 +160,6 @@ report_sample <- function(data,



#' @importFrom stats na.omit xtabs
.report_sample_row.factor <- function(x, column, weights = NULL, digits = 1, ...) {
if (!is.null(weights)) {
x[is.na(weights)] <- NA
Expand Down Expand Up @@ -193,7 +191,6 @@ report_sample <- function(data,
# print-method --------------------------------------------


#' @importFrom insight print_colour export_table
#' @export
print.report_sample <- function(x, ...) {
insight::print_colour("# Descriptive Statistics\n\n", "blue")
Expand All @@ -205,7 +202,6 @@ print.report_sample <- function(x, ...) {
# helper for weighted stuff --------------------------


#' @importFrom stats var na.omit
.weighted_variance <- function(x, weights = NULL) {
if (is.null(weights)) {
return(stats::var(x, na.rm = TRUE))
Expand All @@ -220,7 +216,6 @@ print.report_sample <- function(x, ...) {



#' @importFrom stats sd
.weighted_sd <- function(x, weights = NULL) {
if (is.null(weights)) {
return(stats::sd(x, na.rm = TRUE))
Expand All @@ -230,7 +225,6 @@ print.report_sample <- function(x, ...) {



#' @importFrom stats median
.weighted_median <- function(x, weights = NULL, p = 0.5) {
if (is.null(weights)) {
return(stats::median(x, na.rm = TRUE))
Expand All @@ -253,7 +247,6 @@ print.report_sample <- function(x, ...) {



#' @importFrom stats weighted.mean
.weighted_mean <- function(x, weights = NULL) {
if (is.null(weights)) {
return(mean(x, na.rm = TRUE))
Expand Down
2 changes: 0 additions & 2 deletions R/report_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,11 @@ summary.report_table <- function(object, ...) {
}


#' @importFrom insight format_table
#' @export
format.report_table <- function(x, ...) {
insight::format_table(x, ...)
}

#' @importFrom insight export_table
#' @export
print.report_table <- function(x, ...) {
cat(insight::export_table(format(x, ...), ...))
Expand Down
1 change: 0 additions & 1 deletion R/utils_combine_tables.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@



#' @importFrom utils modifyList
#' @keywords internal
.combine_tables_performance <- function(parameters, performance) {
table <- parameters
Expand Down
1 change: 0 additions & 1 deletion R/utils_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ data_findcols <- function(data, pattern = NULL, starts_with = NULL, ends_with =


#' @rdname data_rename
#' @importFrom utils modifyList
#' @export
data_remove <- function(data, pattern) {
new <- data[!names(data) %in% pattern]
Expand Down

0 comments on commit 1d70ac7

Please sign in to comment.