diff --git a/NAMESPACE b/NAMESPACE index 135692d..fcc7d77 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -10,9 +10,8 @@ S3method(summary,NetSim) S3method(summary,PointSim) S3method(summary,spacejamr) export("%>%") -export(APLNetwork) +export(NetSim) export(PointSim) -export(PowerLawNetwork) export(as.spacejamr) export(compare_networks) importFrom(magrittr,"%>%") diff --git a/R/NetSim-helpers.R b/R/NetSim-helpers.R new file mode 100644 index 0000000..2b5a733 --- /dev/null +++ b/R/NetSim-helpers.R @@ -0,0 +1,137 @@ +# Author: Darren Colby +# Date: 8/31/2021 +# Purpose: To create spatial interaction functions for the NetSim class + +# Spatial interaction functions ------------------------------------------- + + +#' Standard power law function +#' +#' @description helper function to estimate tie probability using a standard +#' power law +#' +#' @usage standard(dist, base_prob, scale, power) +#' +#' @details This function should not be called directly +#' +#' @param dist the distance between a pair of points +#' +#' @return A numeric object representing the proability of two nodes sharing a +#' connection +#' +#' @author Darren Colby +#' Email: dscolby17@@gmail.com +#' @noRd +standard <- function(dist, base_prob, scale, power) { + + prob <- (base_prob / ((1 + (scale * dist)) ^ abs(power))) + + return(prob) + +} + + + +#' Attenuated power law function +#' +#' @description helper function to estimate tie probability using an attenuated +#' power law +#' +#' @usage attenuated(dist, base_prob, scale, power) +#' +#' @details This function should not be called directly +#' +#' @param dist the distance between a pair of points +#' +#' @return A numeric object representing the proability of two nodes sharing a +#' connection +#' +#' @author Darren Colby +#' Email: dscolby17@@gmail.com +#' @noRd +attenuated <- function(dist, base_prob, scale, power) { + + prob <- (base_prob / (1 + (scale * dist) ^ abs(power))) + + + return(prob) + +} + + +#' Arctangent probability law +#' +#' @description helper function to estimate tie probability using an arctangent +#' probability law +#' +#' @usage arctan(dist, base_prob, scale, power) +#' +#' @details This function should not be called directly +#' +#' @param dist the distance between a pair of points +#' +#' @return A numeric object representing the proability of two nodes sharing a +#' connection +#' +#' @author Darren Colby +#' Email: dscolby17@@gmail.com +#' @noRd +arctan <- function(dist, base_prob, scale, power) { + + prob <- base_prob * (1 - ((2 / pi) * atan((scale * dist)))) + + return(prob) + +} + + +#' Exponential decay law +#' +#' @description helper function to estimate tie probability using an exponential +#' decay law +#' +#' @usage decay(dist, base_prob, scale, power) +#' +#' @details This function should not be called directly +#' +#' @param dist the distance between a pair of points +#' +#' @return A numeric object representing the proability of two nodes sharing a +#' connection +#' +#' @author Darren Colby +#' Email: dscolby17@@gmail.com +#' @noRd +decay <- function(dist, base_prob, scale, power) { + + prob <- base_prob / exp((dist * scale)) + + return(prob) + +} + + +#' Logistic probability law +#' +#' @description helper function to estimate tie probability using a logistic +#' probability law +#' +#' @usage logistic(dist, base_prob, scale, power) +#' +#' @details This function should not be called directly +#' +#' @param dist the distance between a pair of points +#' +#' @return A numeric object representing the proability of two nodes sharing a +#' connection +#' +#' @author Darren Colby +#' Email: dscolby17@@gmail.com +#' @noRd +logistic <- function(dist, base_prob, scale, power) { + + prob <- (2 * base_prob) / (1 + (exp(dist * scale))) + + return(prob) +} + diff --git a/R/NetSim.R b/R/NetSim.R index 0b12227..a057def 100644 --- a/R/NetSim.R +++ b/R/NetSim.R @@ -2,62 +2,46 @@ # Date: 8/31/2021 # Purpose: To simulate spatial Bernoulli networks -# Contructor methods to simulate a standard power law network ------------- - - -# Validate input to a PowerLawNetwork constructor -# -# @description validates a spatial Bernoulli network using a standard power law -# -# -# @details This function should not be called by the user -# -# @param point_sim a PointSim object -# @param base_prob the theoretical probability that two nodes (points) with -# distance 0 share a tie. -# @param scale a coefficient to multiply the distance by. -# @param threshold if two node exceed this probability, they will be coded as -# having a tie. -# @param power the exponent at which tie probability decays. -# -# @return An igraph object -# -# @author Darren Colby -# Email: dscolby17@gmail.com -validate_PowerLawNetwork <- function(point_sim, base_prob = 0.9, scale = 1, - threshold = 0.5, power = -2.8) { +# Constructor methods to simulate a standard power law network ------------ - # Ensures proper input - stopifnot(methods::is(point_sim, "PointSim")) - - - # Helper function to estimate the probability of a tie with given parameters - ProbabilityFunction <- function(dist) { - - prob <- (base_prob/((1 + (scale * dist)) ^ abs(power))) - - return(prob) - - } - - - # Helper function to create ties if tie probability exceeds the threshold - ThresholdFunction <- function(prob) { - - ifelse(prob > threshold, 1, 0) - } +#' Validate input to a NetSim constructor +#' +#' @description validates a spatial Bernoulli network +#' +#' @usage validate_NetSim(point_sm, sif, base_prob, scale, threshold, power) +#' +#' @details This function should not be called by the user +#' +#' @param point_sim a PointSim object +#' @param sif the spatial interaction function to use +#' @param base_prob the theoretical probability that two nodes (points) with +#' distance 0 share a tie. +#' @param scale a coefficient to multiply the distance by. +#' @param threshold if two node exceed this probability, they will be coded as +#' having a tie. +#' @param power the exponent at which tie probability decays. +#' +#' @return An igraph object +#' +#' @author Darren Colby +#' Email: dscolby17@gmail.com +#' @noRd +validate_NetSim <- function(point_sim, sif, base_prob, scale, threshold, power) { + # Ensures proper input + stopifnot(methods::is(point_sim, "PointSim")) # Calculate the distance between all pairs of nodes distances <- dplyr::as_tibble(spatstat.geom::pairdist(point_sim), column_name = c("V1", "V2")) %>% # Apply the power law function - dplyr::mutate(dplyr::across(.fns = ProbabilityFunction), + dplyr::mutate(dplyr::across(.fns = sif, base_prob = base_prob, + scale = scale, power = power), # Code as a tie if the probability exceeds the given threshold - dplyr::across(.fns = ThresholdFunction)) %>% + dplyr::across(.fns = function(prob){ifelse(prob > threshold, 1, 0)})) %>% # This is just a good practice dplyr::ungroup() %>% @@ -72,201 +56,57 @@ validate_PowerLawNetwork <- function(point_sim, base_prob = 0.9, scale = 1, } -# Validate and set class attribute of input to the PowerLawNetwork constructor -# -# @description creates a spatial Bernoulli network using a standard power law -# -# @details This function should not be called by the user -# -# @param point_sim a PointSim object -# @param base_prob the theoretical probability that two nodes (points) with -# distance 0 share a tie. -# @param scale a coefficient to multiply the distance by. -# @param threshold if two node exceed this probability, they will be coded as -# having a tie. -# @param power the exponent at which tie probability decays. -# -# @return An igraph object -# -# @author Darren Colby -# Email: dscolby17@gmail.com -new_PowerLawNetwork <- function(point_sim, base_prob, scale, threshold, power) { - - validated_network <- validate_PowerLawNetwork(point_sim, base_prob, scale, - threshold, power) - - validated_network <- structure(validated_network, class = c("NetSim", - "igraph")) - - return(validated_network) - -} - - -#' Simulate a power law network +#' Validate and set class attribute of input to the NetSim constructor #' -#' @description Simulates a spatial Bernoulli network from a NetSim object -#' using a standard power law function as the spatial interaction function. +#' @description creates a spatial Bernoulli network using a standard power law #' -#' @usage PowerLawNetwork(point_sim, base_prob, scale, threshold, power) +#' @usage new_NetSim(point_sim, sif, base_prob, scale, threshold, power) #' -#' @details The algorithm proceeds in three steps. First, it calculates the -#' distance between simulated points from a PointSim object. Then it calculates -#' the distance between all pairs of points. Finally, it uses a standard power -#' law function to calculate that any two point share a tie. If the threshold is -#' exceeded, a tie is created. +#' @details This function should not be called by the user #' #' @param point_sim a PointSim object +#' @param sif a spatial interaction function #' @param base_prob the theoretical probability that two nodes (points) with -#' distance 0 share a tie. Default is 0.9. -#' @param scale a coefficient to multiply the distance by. Default is 1. +#' distance 0 share a tie. +#' @param scale a coefficient to multiply the distance by. #' @param threshold if two node exceed this probability, they will be coded as -#' having a tie. Default is 0.5. -#' @param power the exponent at which tie probability decays. Default is -2.8. -#' -#' @return A network object of class 'igraph' that can be manipulated using the -#' 'igraph' package. -#' -#' @example -#' # Load spacejamr object -#' data("RI") +#' having a tie. +#' @param power the exponent at which tie probability decays. #' -#' ri_points <- PointSim(points = 10, window = RI, seed = 42) -#' power_law <- PowerLawNetwork(ri_points, base_prob = 0.92, scale = 1, -#' threshold = 0.5, power = -2.4) +#' @return An object of classes 'NetSim' and 'igraph' that can be further +#' manipulated with 'igraph' functions and methods #' -#' @author Darren Colby \cr -#' Email: dscolby17@@gmail.com -#' -#' @references Butts, Carter T. Spatial models of large-scale interpersonal -#' networks. Dissertation. (2002). -#' @export -PowerLawNetwork <- function(point_sim, base_prob = 0.9, scale = 1, - threshold = 0.5, power = -2.8) { - - validated_network <- new_PowerLawNetwork(point_sim, base_prob, scale, - threshold, power) - - return(validated_network) - -} - - -# Attenuated power law network generator ---------------------------------- - - -# Validate inputs to an APLNetwork constructor -# -# @description validates a spatial Bernoulli network using an attenuated power -# law -# -# @details This function should not be called by the user -# -# @param point_sim a PointSim object -# @param base_prob the theoretical probability that two nodes (points) with -# distance 0 share a tie. -# @param scale a coefficient to multiply the distance by. -# @param threshold if two node exceed this probability, they will be coded as -# having a tie. -# @param power the exponent at which tie probability decays. -# -# @return An igraph object -# -# @author Darren Colby -# Email: dscolby17@gmail.com -validate_APLNetwork <- function(point_sim, base_prob, scale, threshold, power) { - - stopifnot(methods::is(point_sim, "PointSim")) - - - # Helper function to estimate the probability of a tie with given parameters - ProbabilityFunction <- function(dist) { - - # Attenuated power law - prob <- (base_prob / (1 + (scale * dist) ^ abs(power))) - - - return(prob) - - } - - - # Helper function to create ties if tie probability exceeds the threshold - ThresholdFunction <- function(prob) { +#' @author Darren Colby +#' Email: dscolby17@gmail.com +#' @noRd +new_NetSim <- function(point_sim, sif, base_prob, scale, threshold, power) { - ifelse(prob > threshold, 1, 0) + validated_net <- validate_NetSim(point_sim, sif, base_prob, scale, + threshold, power) - } + validated_net <- structure(validated_net, class = c("NetSim", "igraph")) - - # Calculate the distance between all pairs of nodes - distances <- dplyr::as_tibble(spatstat.geom::pairdist(point_sim), - column_name = c("V1", "V2")) %>% - - # Apply the power law function - dplyr::mutate(dplyr::across(.fns = ProbabilityFunction), - - # Code as a tie if the probability exceeds the given threshold - dplyr::across(.fns = ThresholdFunction)) %>% - - # This is just a good practice - dplyr::ungroup() %>% - as.matrix() - - simulated_network <- igraph::graph_from_adjacency_matrix(distances, - mode = "undirected") %>% - igraph::simplify() # Removes self loops - - return(simulated_network) + return(validated_net) } -# Validate and set class attribute to input passed to APLNetwork -# -# @description creates a spatial Bernoulli network using an attenuated power law -# -# @details This function should not be called by the user -# -# @param point_sim a PointSim object -# @param base_prob the theoretical probability that two nodes (points) with -# distance 0 share a tie. -# @param scale a coefficient to multiply the distance by. -# @param threshold if two node exceed this probability, they will be coded as -# having a tie. -# @param power the exponent at which tie probability decays. -# -# @return An igraph object -# -# @author Darren Colby -# Email: dscolby17@gmail.com -new_APLNetwork <- function(point_sim, base_prob, scale, threshold, power) { - - validated_network <- validate_APLNetwork(point_sim, base_prob, scale, - threshold, power) - - validated_network <- structure(validated_network, class = c("NetSim", - "igraph")) - - return(validated_network) - -} - - -#' Simulate an attenuated power law network +#' Simulate a network from a point process or sequence #' #' @description Simulates a spatial Bernoulli network from a NetSim object -#' using an attenuated power law function as the spatial interaction function. +#' using one of six probability law distributions. #' -#' @usage APLNetwork(point_sim, base_prob, scale, threshold, power) +#' @usage NetSim(point_sim, sif, base_prob, scale, threshold, power) #' #' @details The algorithm proceeds in three steps. First, it calculates the #' distance between simulated points from a PointSim object. Then it calculates -#' the distance between all pairs of points. Finally, it uses an attenuated -#' power law function to calculate that any two point share a tie. If the +#' the distance between all pairs of points. Finally, it uses a spatial +#' interaction function to calculate that any two point share a tie. If the #' threshold is exceeded, a tie is created. #' #' @param point_sim a PointSim object +#' @param sif the spatial interaction function to use. Default is a standard +#' power law function. #' @param base_prob the theoretical probability that two nodes (points) with #' distance 0 share a tie. Default is 0.9. #' @param scale a coefficient to multiply the distance by. Default is 1. @@ -274,16 +114,16 @@ new_APLNetwork <- function(point_sim, base_prob, scale, threshold, power) { #' having a tie. Default is 0.5. #' @param power the exponent at which tie probability decays. Default is -2.8. #' -#' @return A network object of class 'igraph' that can be manipulated using the -#' 'igraph' package. +#' @return A network object of class 'NetSim' and 'igraph' that can be +#' manipulated using the igraph' package. #' #' @example #' # Load spacejamr object #' data("RI") #' #' ri_points <- PointSim(points = 10, window = RI, seed = 42) -#' apl_points <- APLNetwork(ri_points, base_prob = 0.92, scale = 1, -#' threshold = 0.5, power = -2.4) +#' power_law <- NetSim(ri_points, base_prob = 0.92, scale = 1, threshold = 0.5, +#' power = -2.4) #' #' @author Darren Colby \cr #' Email: dscolby17@@gmail.com @@ -291,13 +131,13 @@ new_APLNetwork <- function(point_sim, base_prob, scale, threshold, power) { #' @references Butts, Carter T. Spatial models of large-scale interpersonal #' networks. Dissertation. (2002). #' @export -APLNetwork <- function(point_sim, base_prob = 0.9, scale = 1, - threshold = 0.5, power = -2.8) { +NetSim <- function(point_sim, sif = standard, base_prob = 0.9, scale = 1, + threshold = 0.5, power = -2.8) { - validated_network <- new_APLNetwork(point_sim, base_prob, scale, threshold, - power) + validated_net <- new_NetSim(point_sim, sif, base_prob, scale, threshold, + power) - return(validated_network) + return(validated_net) } @@ -310,6 +150,8 @@ APLNetwork <- function(point_sim, base_prob = 0.9, scale = 1, #' @description This can take either a PowerLawNetwork or APLNetwork object as #' input, both of which are chidren of the NetSim class. #' +#' @usage plot(x) +#' #' @details This method returns a ggraph object, which can be further refined #' using standard ggraph and ggplot facilities. #' @@ -329,9 +171,9 @@ APLNetwork <- function(point_sim, base_prob = 0.9, scale = 1, #' data("RI") #' #' ri_points <- PointSim(points = 10, window = RI, seed = 42) -#' apl_points <- APLNetwork(ri_points, base_prob = 0.92, scale = 1, -#' threshold = 0.5, power = -2.4) -#' plot(apl_points) +#' spl_points <- NetSim(ri_points, base_prob = 0.92, scale = 1, threshold = 0.5, +#' power = -2.4) +#' plot(spl_points) #' #' @author Darren Colby \cr #' Email:dscolby17@@gmail.com @@ -359,6 +201,8 @@ plot.NetSim <- function(x, y, ..., layout = "stress", #' #' @description Plots a NetSim object and returns a ggraph object #' +#' @usage print(x) +#' #' @param x a NetSim object #' @param ... ignored. #' @@ -369,9 +213,9 @@ plot.NetSim <- function(x, y, ..., layout = "stress", #' data("RI") #' #' ri_points <- PointSim(points = 10, window = RI, seed = 42) -#' apl_points <- APLNetwork(ri_points, base_prob = 0.92, scale = 1, -#' threshold = 0.5, power = -2.4) -#' print(apl_points) +#' spl_points <- NetSim(ri_points, base_prob = 0.92, scale = 1, threshold = 0.5, +#' power = -2.4) +#' print(spl_points) #' #' @author Darren Colby \cr #' Email: dscolby17@@gmail.com @@ -388,6 +232,8 @@ print.NetSim <- function(x, ...) { #' #' @description Prints a summary of a NetSim object #' +#' @usage summary(object) +#' #' @param object a NetSim object #' @param ... ignored. #' @@ -398,9 +244,9 @@ print.NetSim <- function(x, ...) { #' data("RI") #' #' ri_points <- PointSim(points = 10, window = RI, seed = 42) -#' apl_points <- APLNetwork(ri_points, base_prob = 0.92, scale = 1, -#' threshold = 0.5, power = -2.4) -#' summary(apl_points) +#' spl_points <- NetSim(ri_points, base_prob = 0.92, scale = 1, threshold = 0.5, +#' power = -2.4) +#' summary(spl_points) #' #' @author Darren Colby \cr #' Email: dscolby17@@gmail.com diff --git a/R/PointSim-helpers.R b/R/PointSim-helpers.R index 89cd437..f22595b 100644 --- a/R/PointSim-helpers.R +++ b/R/PointSim-helpers.R @@ -21,7 +21,7 @@ #' simulated points #' #' @author Darren Colby -#' Email: dscolby17@gmail.com +#' Email: dscolby17@@gmail.com #' @noRd poisson_process <- function(n, win) { @@ -48,7 +48,7 @@ poisson_process <- function(n, win) { #' contains simulated points #' #' @author Darren Colby -#' Email: dscolby17@gmail.com +#' Email: dscolby17@@gmail.com #' @noRd halton <- function(n, win) { diff --git a/man/APLNetwork.Rd b/man/NetSim.Rd similarity index 64% rename from man/APLNetwork.Rd rename to man/NetSim.Rd index 154c917..da22222 100644 --- a/man/APLNetwork.Rd +++ b/man/NetSim.Rd @@ -1,14 +1,17 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/NetSim.R -\name{APLNetwork} -\alias{APLNetwork} -\title{Simulate an attenuated power law network} +\name{NetSim} +\alias{NetSim} +\title{Simulate a network from a point process or sequence} \usage{ -APLNetwork(point_sim, base_prob, scale, threshold, power) +NetSim(point_sim, sif, base_prob, scale, threshold, power) } \arguments{ \item{point_sim}{a PointSim object} +\item{sif}{the spatial interaction function to use. Default is a standard +power law function.} + \item{base_prob}{the theoretical probability that two nodes (points) with distance 0 share a tie. Default is 0.9.} @@ -20,18 +23,18 @@ having a tie. Default is 0.5.} \item{power}{the exponent at which tie probability decays. Default is -2.8.} } \value{ -A network object of class 'igraph' that can be manipulated using the -'igraph' package. +A network object of class 'NetSim' and 'igraph' that can be +manipulated using the igraph' package. } \description{ Simulates a spatial Bernoulli network from a NetSim object -using an attenuated power law function as the spatial interaction function. +using one of six probability law distributions. } \details{ The algorithm proceeds in three steps. First, it calculates the distance between simulated points from a PointSim object. Then it calculates -the distance between all pairs of points. Finally, it uses an attenuated -power law function to calculate that any two point share a tie. If the +the distance between all pairs of points. Finally, it uses a spatial +interaction function to calculate that any two point share a tie. If the threshold is exceeded, a tie is created. } \references{ diff --git a/man/PowerLawNetwork.Rd b/man/PowerLawNetwork.Rd deleted file mode 100644 index b99db40..0000000 --- a/man/PowerLawNetwork.Rd +++ /dev/null @@ -1,44 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/NetSim.R -\name{PowerLawNetwork} -\alias{PowerLawNetwork} -\title{Simulate a power law network} -\usage{ -PowerLawNetwork(point_sim, base_prob, scale, threshold, power) -} -\arguments{ -\item{point_sim}{a PointSim object} - -\item{base_prob}{the theoretical probability that two nodes (points) with -distance 0 share a tie. Default is 0.9.} - -\item{scale}{a coefficient to multiply the distance by. Default is 1.} - -\item{threshold}{if two node exceed this probability, they will be coded as -having a tie. Default is 0.5.} - -\item{power}{the exponent at which tie probability decays. Default is -2.8.} -} -\value{ -A network object of class 'igraph' that can be manipulated using the -'igraph' package. -} -\description{ -Simulates a spatial Bernoulli network from a NetSim object -using a standard power law function as the spatial interaction function. -} -\details{ -The algorithm proceeds in three steps. First, it calculates the -distance between simulated points from a PointSim object. Then it calculates -the distance between all pairs of points. Finally, it uses a standard power -law function to calculate that any two point share a tie. If the threshold is -exceeded, a tie is created. -} -\references{ -Butts, Carter T. Spatial models of large-scale interpersonal -networks. Dissertation. (2002). -} -\author{ -Darren Colby \cr -Email: dscolby17@gmail.com -} diff --git a/man/plot.NetSim.Rd b/man/plot.NetSim.Rd index 77b9a06..95e2fd2 100644 --- a/man/plot.NetSim.Rd +++ b/man/plot.NetSim.Rd @@ -4,15 +4,7 @@ \alias{plot.NetSim} \title{Plot a simulated network from a NetSim object} \usage{ -\method{plot}{NetSim}( - x, - y, - ..., - layout = "stress", - title = "Network Simulation", - node_color = "red", - edge_color = "blue" -) +plot(x) } \arguments{ \item{x}{a NetSim graph} diff --git a/man/print.NetSim.Rd b/man/print.NetSim.Rd index 7ab5bd2..d05840e 100644 --- a/man/print.NetSim.Rd +++ b/man/print.NetSim.Rd @@ -4,7 +4,7 @@ \alias{print.NetSim} \title{Print information from a NetSim object} \usage{ -\method{print}{NetSim}(x, ...) +print(x) } \arguments{ \item{x}{a NetSim object} diff --git a/man/summary.NetSim.Rd b/man/summary.NetSim.Rd index 11280a3..81e7e7b 100644 --- a/man/summary.NetSim.Rd +++ b/man/summary.NetSim.Rd @@ -4,7 +4,7 @@ \alias{summary.NetSim} \title{Summary of NetSim graphs} \usage{ -\method{summary}{NetSim}(object, ...) +summary(object) } \arguments{ \item{object}{a NetSim object} diff --git a/tests/testthat/test-NetSim.R b/tests/testthat/test-NetSim.R index c4f9fd3..be16cbe 100644 --- a/tests/testthat/test-NetSim.R +++ b/tests/testthat/test-NetSim.R @@ -3,10 +3,9 @@ library(spacejamr) # Data for tests path <- system.file("extdata", "points.rds", package ="spacejamr") points <- readRDS(path) -pl <- PowerLawNetwork(points) -apl <- APLNetwork(points) +pl <- NetSim(points) -test_that("we can create power law networks from a PointSim object", { +test_that("we can simulate networks from a PointSim object", { # Ensures the correct class expect_identical(class(pl), c("NetSim", "igraph")) @@ -16,12 +15,3 @@ test_that("we can create power law networks from a PointSim object", { }) -test_that("we can create attenuated power law networks from a PointSim object", { - - # Ensures the correct class - expect_identical(class(apl), c("NetSim", "igraph")) - - # Ensures the correct length - expect_equal(length(apl), 10) - -}) diff --git a/tests/testthat/test-compare.R b/tests/testthat/test-compare.R index 8cdbe4c..fa86ab8 100644 --- a/tests/testthat/test-compare.R +++ b/tests/testthat/test-compare.R @@ -7,8 +7,8 @@ options(warn = -1) # Load data for the test data("RI") ri_points <- PointSim(3, RI) -pl <- PowerLawNetwork(ri_points) -apl <- APLNetwork(ri_points) +pl <- NetSim(ri_points) +apl <- NetSim(ri_points) test_that("we can compare summary statistics of two networks", { diff --git a/tests/testthat/test-generics.R b/tests/testthat/test-generics.R index c9409a6..476dff6 100644 --- a/tests/testthat/test-generics.R +++ b/tests/testthat/test-generics.R @@ -3,7 +3,7 @@ library(spacejamr) # Load data for the test data("RI") ri_points <- PointSim(3, RI) -pl <- PowerLawNetwork(ri_points) +pl <- NetSim(ri_points) test_that("we can plot objects created with the spacejamr package", {