Skip to content

Commit

Permalink
remove defunct packages
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Oct 16, 2023
1 parent d8acc6d commit 2b7e93f
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 54 deletions.
3 changes: 1 addition & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: parameters
Title: Processing of Model Parameters
Version: 0.21.2.6
Version: 0.21.2.7
Authors@R:
c(person(given = "Daniel",
family = "Lüdecke",
Expand Down Expand Up @@ -115,7 +115,6 @@ Suggests:
drc,
DRR,
effectsize (>= 0.8.2),
EGAnet (>= 0.7),
emmeans (>= 1.7.0),
estimatr,
factoextra,
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
* `print_md()` for `compare_parameters()` now gains more arguments, similar to
the `print()` method.

* `n_factors()` no longer supports `package = "EGAnet"`, as package *EGAnet* was
removed from CRAN.

## Bug fixes

* Fixed issue in `print_html()` for objects from package _ggeffects_.
Expand Down
93 changes: 47 additions & 46 deletions R/n_factors.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
#' Principal Components. `"default"` will select `"minres"` if
#' `type = "FA"` and `"pc"` if `type = "PCA"`.
#' @param package Package from which respective methods are used. Can be
#' `"all"` or a vector containing `"nFactors"`, `"psych"`, `"PCDimension"`, `"fit"` or
#' `"EGAnet"`. Note that `"fit"` (which actually also relies on the `psych`
#' package) and `"EGAnet"` can be very slow for bigger
#' datasets. Thus, the default is `c("nFactors", "psych")`. You must have
#' the respective packages installed for the methods to be used.
#' `"all"` or a vector containing `"nFactors"`, `"psych"`, `"PCDimension"` or
#' `"fit"`. Note that `"fit"` (which actually also relies on the **psych**
#' package) can be very slow for bigger datasets. Thus, the default is
#' `c("nFactors", "psych")`. You must have the respective packages installed
#' for the methods to be used.
#' @param safe If `TRUE`, the function will run all the procedures in try
#' blocks, and will only return those that work and silently skip the ones
#' that may fail.
Expand All @@ -49,7 +49,7 @@
#' `n_components()` is a convenient short for `n_factors(type =
#' "PCA")`.
#'
#' @examplesIf require("PCDimension", quietly = TRUE) && require("nFactors", quietly = TRUE) && require("EGAnet", quietly = TRUE)
#' @examplesIf require("PCDimension", quietly = TRUE) && require("nFactors", quietly = TRUE)
#' library(parameters)
#' n_factors(mtcars, type = "PCA")
#'
Expand Down Expand Up @@ -120,7 +120,7 @@ n_factors <- function(x,
n_max = NULL,
...) {
if (all(package == "all")) {
package <- c("nFactors", "EGAnet", "psych", "fit", "pcdimension")
package <- c("nFactors", "psych", "fit", "pcdimension")
}

# Get number of observations
Expand Down Expand Up @@ -247,25 +247,27 @@ n_factors <- function(x,
}
}

# EGAnet -------------------------------------------
if ("EGAnet" %in% package) {
insight::check_if_installed("EGAnet")
# EGAnet was removed from CRAN

if (safe) {
out <- rbind(
out,
tryCatch(.n_factors_ega(x, cor, nobs, eigen_values, type),
# warning = function(w) data.frame(),
error = function(e) data.frame()
)
)
} else {
out <- rbind(
out,
.n_factors_ega(x, cor, nobs, eigen_values, type)
)
}
}
# EGAnet -------------------------------------------
# if ("EGAnet" %in% package) {
# insight::check_if_installed("EGAnet")

# if (safe) {
# out <- rbind(
# out,
# tryCatch(.n_factors_ega(x, cor, nobs, eigen_values, type),
# # warning = function(w) data.frame(),
# error = function(e) data.frame()
# )
# )
# } else {
# out <- rbind(
# out,
# .n_factors_ega(x, cor, nobs, eigen_values, type)
# )
# }
# }


# psych -------------------------------------------
Expand Down Expand Up @@ -545,29 +547,28 @@ print.n_clusters <- print.n_factors
}


# EGAnet was removed from CRAN

# EGAnet ------------------------

#' @keywords internal
.n_factors_ega <- function(x = NULL,
cor = NULL,
nobs = NULL,
eigen_values = NULL,
type = "FA") {
# Replace with own correlation matrix
junk <- utils::capture.output(suppressWarnings(suppressMessages(
nfac_glasso <- EGAnet::EGA(cor, n = nobs, model = "glasso", plot.EGA = FALSE)$n.dim # nolint
)))
junk <- utils::capture.output(suppressWarnings(suppressMessages(
nfac_TMFG <- EGAnet::EGA(cor, n = nobs, model = "TMFG", plot.EGA = FALSE)$n.dim # nolint
)))

.data_frame(
n_Factors = as.numeric(c(nfac_glasso, nfac_TMFG)),
Method = c("EGA (glasso)", "EGA (TMFG)"),
Family = "EGA"
)
}
# .n_factors_ega <- function(x = NULL,
# cor = NULL,
# nobs = NULL,
# eigen_values = NULL,
# type = "FA") {
# # Replace with own correlation matrix
# junk <- utils::capture.output(suppressWarnings(suppressMessages(
# nfac_glasso <- EGAnet::EGA(cor, n = nobs, model = "glasso", plot.EGA = FALSE)$n.dim # nolint
# )))
# junk <- utils::capture.output(suppressWarnings(suppressMessages(
# nfac_TMFG <- EGAnet::EGA(cor, n = nobs, model = "TMFG", plot.EGA = FALSE)$n.dim # nolint
# )))

# .data_frame(
# n_Factors = as.numeric(c(nfac_glasso, nfac_TMFG)),
# Method = c("EGA (glasso)", "EGA (TMFG)"),
# Family = "EGA"
# )
# }


# psych ------------------------
Expand Down
12 changes: 6 additions & 6 deletions man/n_factors.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2b7e93f

Please sign in to comment.