Skip to content

Commit

Permalink
docs: replace instances of #' if with #' @examplesIf (#1698)
Browse files Browse the repository at this point in the history
  • Loading branch information
maelle authored Feb 20, 2025
1 parent f7ab64d commit 22cd83e
Show file tree
Hide file tree
Showing 112 changed files with 176 additions and 161 deletions.
31 changes: 19 additions & 12 deletions R/centrality.R
Original file line number Diff line number Diff line change
Expand Up @@ -668,19 +668,26 @@ arpack_defaults <- function() {
#'
#' ## First three eigenvalues of the adjacency matrix of a graph
#' ## We need the 'Matrix' package for this
#' if (require(Matrix)) {
#' set.seed(42)
#' g <- sample_gnp(1000, 5 / 1000)
#' M <- as_adjacency_matrix(g, sparse = TRUE)
#' f2 <- function(x, extra = NULL) {
#' cat(".")
#' as.vector(M %*% x)
#' }
#' baev <- arpack(f2, sym = TRUE, options = list(
#' n = vcount(g), nev = 3, ncv = 8,
#' which = "LM", maxiter = 2000
#' ))
#' @examplesIf rlang::is_installed("Matrix")
#' library("Matrix")
#' set.seed(42)
#' g <- sample_gnp(1000, 5 / 1000)
#' M <- as_adjacency_matrix(g, sparse = TRUE)
#' f2 <- function(x, extra = NULL) {
#' cat(".")
#' as.vector(M %*% x)
#' }
#' baev <- arpack(
#' f2,
#' sym = TRUE,
#' options = list(
#' n = vcount(g),
#' nev = 3,
#' ncv = 8,
#' which = "LM",
#' maxiter = 2000
#' )
#' )
#' @family arpack
#' @export
arpack <- function(func, extra = NULL, sym = FALSE, options = arpack_defaults(),
Expand Down
6 changes: 3 additions & 3 deletions R/demo.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ igraphdemo <- function(which) { # nocov start
#' @examples
#'
#' igraph_demo()
#' if (interactive() && requireNamespace("tcltk", quietly = TRUE)) {
#' igraph_demo("centrality")
#' }
#'
#' @examplesIf interactive() && rlang::is_installed("tcltk")
#' igraph_demo("centrality")
#'
igraph_demo <- function(which) {
if (missing(which)) {
Expand Down
7 changes: 4 additions & 3 deletions R/games.R
Original file line number Diff line number Diff line change
Expand Up @@ -1877,9 +1877,10 @@ sbm <- function(...) constructor_spec(sample_sbm, ...)
#' ), nrow = 3)
#' g <- sample_hierarchical_sbm(100, 10, rho = c(3, 3, 4) / 10, C = C, p = 1 / 20)
#' g
#' if (require(Matrix)) {
#' image(g[])
#' }
#'
#' @examplesIf rlang::is_installed("Matrix")
#' library("Matrix")
#' image(g[])
#' @family games
#' @export
#' @cdocs igraph_hsbm_game
Expand Down
6 changes: 3 additions & 3 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -527,9 +527,9 @@ plot.igraph <- function(x,
#'
#' g <- make_lattice(c(5, 5, 5))
#' coords <- layout_with_fr(g, dim = 3)
#' if (interactive() && requireNamespace("rgl", quietly = TRUE)) {
#' rglplot(g, layout = coords)
#' }
#'
#' @examplesIf interactive() && rlang::is_installed("rgl")
#' rglplot(g, layout = coords)
#'
rglplot <- function(x, ...) {
UseMethod("rglplot", x)
Expand Down
14 changes: 6 additions & 8 deletions R/plot.common.R
Original file line number Diff line number Diff line change
Expand Up @@ -1440,14 +1440,12 @@ i.default.values[["plot"]] <- i.plot.default
#' @examples
#'
#' g <- make_ring(10)
#' values <- lapply(1:10, function(x) sample(1:10, 3))
#' if (interactive()) {
#' plot(g,
#' vertex.shape = "pie", vertex.pie = values,
#' vertex.pie.color = list(heat.colors(5)),
#' vertex.size = seq(10, 30, length.out = 10), vertex.label = NA
#' )
#' }
#' values <- lapply(1:10, function(x) sample(1:10,3))
#'
#' @examplesIf interactive()
#' plot(g, vertex.shape = "pie", vertex.pie = values,
#' vertex.pie.color = list(heat.colors(5)),
#' vertex.size = seq(10, 30, length.out = 10), vertex.label = NA)
#' @rdname vertex.shape.pie
#' @name vertex.shape.pie
NULL
2 changes: 1 addition & 1 deletion man/are_adjacent.Rd

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

32 changes: 20 additions & 12 deletions man/arpack.Rd

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

2 changes: 1 addition & 1 deletion man/articulation_points.Rd

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

2 changes: 1 addition & 1 deletion man/as_directed.Rd

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

2 changes: 1 addition & 1 deletion man/assortativity.Rd

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

2 changes: 1 addition & 1 deletion man/automorphism_group.Rd

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

2 changes: 1 addition & 1 deletion man/biconnected_components.Rd

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

2 changes: 1 addition & 1 deletion man/bipartite_mapping.Rd

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

2 changes: 1 addition & 1 deletion man/bipartite_projection.Rd

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

2 changes: 1 addition & 1 deletion man/canonical_permutation.Rd

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

2 changes: 1 addition & 1 deletion man/centr_betw_tmax.Rd

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

2 changes: 1 addition & 1 deletion man/centr_clo.Rd

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

2 changes: 1 addition & 1 deletion man/centr_clo_tmax.Rd

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

2 changes: 1 addition & 1 deletion man/centr_degree.Rd

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

2 changes: 1 addition & 1 deletion man/centr_eigen.Rd

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

2 changes: 1 addition & 1 deletion man/centr_eigen_tmax.Rd

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

2 changes: 1 addition & 1 deletion man/centralize.Rd

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

2 changes: 1 addition & 1 deletion man/cliques.Rd

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

2 changes: 1 addition & 1 deletion man/components.Rd

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

2 changes: 1 addition & 1 deletion man/consensus_tree.Rd

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

2 changes: 1 addition & 1 deletion man/contract.Rd

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

2 changes: 1 addition & 1 deletion man/convex_hull.Rd

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

2 changes: 1 addition & 1 deletion man/count_automorphisms.Rd

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

2 changes: 1 addition & 1 deletion man/count_triangles.Rd

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

2 changes: 1 addition & 1 deletion man/degree.Rd

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

2 changes: 1 addition & 1 deletion man/dim_select.Rd

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

2 changes: 1 addition & 1 deletion man/distances.Rd

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

2 changes: 1 addition & 1 deletion man/diversity.Rd

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

2 changes: 1 addition & 1 deletion man/dyad_census.Rd

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

2 changes: 1 addition & 1 deletion man/eccentricity.Rd

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

2 changes: 1 addition & 1 deletion man/edge_density.Rd

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

Loading

0 comments on commit 22cd83e

Please sign in to comment.