Skip to content

Commit

Permalink
Bug on turtleSet caused by rbind.agentmatrix
Browse files Browse the repository at this point in the history
  • Loading branch information
SarahBauduin committed Apr 19, 2024
1 parent 4c89e69 commit c00c080
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion R/agentMatrix-Class-methods.R
Expand Up @@ -746,7 +746,11 @@ cbind.agentMatrix <- function(..., deparse.level) {
#' @rdname agentMatrix-bind-methods
rbind.agentMatrix <- function(..., deparse.level = 1) {
dots <- list(...)
levelsSame <- isTRUE(do.call(all.equal, lapply(dots, function(x) x@levels)))
#levelsSame <- isTRUE(do.call(all.equal, lapply(dots, function(x) x@levels)))
# Bug with this line
# Creates a mistake when levels are different, creating NA when used in turtleSet
allSame <- function(x) length(unique(x)) == 1
levelsSame <- allSame(lapply(dots, function(x) x@levels))
if (levelsSame) {
# if same, then faster rbind of the matrices
if (isTRUE(do.call(all.equal, lapply(dots, colnames)))) {
Expand Down

0 comments on commit c00c080

Please sign in to comment.