Skip to content

Commit

Permalink
24.4.26.1
Browse files Browse the repository at this point in the history
Bug-fix for `make_3d_Isingland()`, The function now allow character values for the `x` and `y`	arguments.
  • Loading branch information
Sciurus365 committed Apr 26, 2024
1 parent 40aa025 commit 2e4fb63
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
@@ -1,7 +1,7 @@
Type: Package
Package: Isinglandr
Title: Landscape Construction and Simulation for Ising Networks
Version: 0.1.1
Version: 0.1.1.9000
Authors@R: c(
person("Jingmeng", "Cui", , "jingmeng.cui@outlook.com", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-3421-8457")),
Expand Down Expand Up @@ -46,4 +46,4 @@ Suggests:
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.2
RoxygenNote: 7.3.0
5 changes: 5 additions & 0 deletions NEWS.md
@@ -1,3 +1,8 @@
# Development version

- Bug-fix for `make_3d_Isingland()`:
- The function now allow character values for the `x` and `y` arguments.

# Isinglandr 0.1.1

- Bug-fix for the Shiny app (`shiny_Isingland_MDD()`):
Expand Down
12 changes: 11 additions & 1 deletion R/landscape.R
Expand Up @@ -190,7 +190,8 @@ plot.2d_Isingland_matrix <- function(x, ...) {
#'
#' @inheritParams make_2d_Isingland
#' @param x,y Two vectors specifying the indices or the names of the
#' nodes for two categories.
#' nodes for two categories. If they are character vectors, the names
#' should match the row names of the `thresholds` matrix.
#'
#' @seealso [make_2d_Isingland()] for the algorithm.
#'
Expand All @@ -207,6 +208,15 @@ make_3d_Isingland <- function(thresholds, weiadj, x, y, beta = 1, transform = FA
l_2d <- make_2d_Isingland(thresholds, weiadj, beta, transform)
d <- l_2d$dist_raw

if (is.character(x)) {
if (!all(x %in% row.names(thresholds))) stop("The names in x are not found in the row names of the thresholds matrix.")
x <- which(row.names(thresholds) %in% x)
}
if (is.character(y)) {
if (!all(y %in% row.names(thresholds))) stop("The names in y are not found in the row names of the thresholds matrix.")
y <- which(row.names(thresholds) %in% y)
}

## summarize based on the number of symptoms in the groups x & y
d_sum <- d %>%
dplyr::rowwise() %>%
Expand Down
3 changes: 2 additions & 1 deletion man/make_3d_Isingland.Rd

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

0 comments on commit 2e4fb63

Please sign in to comment.