Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/RoheLab/fastRG
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpghayes committed Aug 22, 2024
2 parents 93c2c92 + 3658b26 commit a538334
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 41 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ Depends:
Matrix
Imports:
dplyr,
ellipsis,
ggplot2,
glue,
igraph,
methods,
rlang (>= 1.0.0),
RSpectra,
stats,
tibble,
Expand Down
2 changes: 1 addition & 1 deletion R/directed_factor_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ new_directed_factor_model <- function(
allow_self_loops,
...,
subclass = character()) {
ellipsis::check_dots_unnamed()
rlang::check_dots_unnamed()

n <- nrow(X)
k1 <- ncol(X)
Expand Down
2 changes: 1 addition & 1 deletion R/expected-degrees.R
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
#' svds(dfm)
#'
expected_edges <- function(factor_model, ...) {
ellipsis::check_dots_empty()
rlang::check_dots_empty()
UseMethod("expected_edges")
}

Expand Down
21 changes: 3 additions & 18 deletions R/expected-spectra.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@ eigs_sym.undirected_factor_model <- function(
which = "LM", sigma = NULL,
opts = list(),
...) {
if (!requireNamespace("RSpectra", quietly = TRUE)) {
stop(
"Must install `RSpectra` for this functionality.",
call. = FALSE
)
}
rlang::check_installed("RSpectra")

Ax <- function(x, args) as.numeric(args$X %*% (args$SXt %*% x))

Expand All @@ -48,12 +43,7 @@ svds.undirected_factor_model <- function(
nv = k,
opts = list(),
...) {
if (!requireNamespace("RSpectra", quietly = TRUE)) {
stop(
"Must install `RSpectra` for this functionality.",
call. = FALSE
)
}
rlang::check_installed("RSpectra")

Ax <- function(x, args) {
as.numeric(args$X %*% (tcrossprod(args$S, args$X) %*% x))
Expand Down Expand Up @@ -92,12 +82,7 @@ svds.directed_factor_model <- function(
nv = k,
opts = list(),
...) {
if (!requireNamespace("RSpectra", quietly = TRUE)) {
stop(
"Must install `RSpectra` for this functionality.",
call. = FALSE
)
}
rlang::check_installed("RSpectra")

Ax <- function(x, args) {
as.numeric(args$X %*% (tcrossprod(args$S, args$Y) %*% x))
Expand Down
2 changes: 1 addition & 1 deletion R/sample_edgelist.R
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
sample_edgelist <- function(
factor_model,
...) {
ellipsis::check_dots_unnamed()
rlang::check_dots_unnamed()
UseMethod("sample_edgelist")
}

Expand Down
10 changes: 2 additions & 8 deletions R/sample_igraph.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,9 @@
sample_igraph <- function(
factor_model,
...) {
ellipsis::check_dots_unnamed()
rlang::check_dots_unnamed()

if (!(requireNamespace("igraph", quietly = TRUE))) {
stop(
"Must install `igraph` package to return graphs as `igraph` ",
"objects",
call. = FALSE
)
}
rlang::check_installed("igraph", "to return graphs as `igraph` objects.")

UseMethod("sample_igraph")
}
Expand Down
2 changes: 1 addition & 1 deletion R/sample_sparse.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
sample_sparse <- function(
factor_model,
...) {
ellipsis::check_dots_unnamed()
rlang::check_dots_unnamed()
UseMethod("sample_sparse")
}

Expand Down
11 changes: 2 additions & 9 deletions R/sample_tidygraph.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,8 @@
sample_tidygraph <- function(
factor_model,
...) {
ellipsis::check_dots_unnamed()

if (!(requireNamespace("tidygraph", quietly = TRUE))) {
stop(
"Must install `tidygraph` package to return graphs as `tidygraph` ",
"objects",
call. = FALSE
)
}
rlang::check_dots_unnamed()
rlang::check_installed("igraph", "to return graphs as `tidygraph` objects.")

UseMethod("sample_tidygraph")
}
Expand Down
2 changes: 1 addition & 1 deletion R/undirected_factor_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ new_undirected_factor_model <- function(
poisson_edges = TRUE,
allow_self_loops = TRUE,
subclass = character()) {
ellipsis::check_dots_unnamed()
rlang::check_dots_unnamed()

n <- nrow(X)
k <- ncol(S)
Expand Down

0 comments on commit a538334

Please sign in to comment.