Skip to content

Commit

Permalink
rbind metadata bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
philipdelff committed Jun 10, 2024
1 parent 8a8d38a commit cdc6bca
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion R/NMsimRes_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ dimnames.NMsimRes <- function(x,...){
##' @export
rbind.NMsimRes <- function(x,...){

list.ModTab <- lapply(c(x,list(...)),function(y)attributes(y)$NMsimModTab)
list.ModTab <- lapply(c(list(x),list(...)),function(y)attributes(y)$NMsimModTab)
## list.ModTab <- list.ModTab[!sapply(list.ModTab,is.null)]
ModTab <- rbindlist(list.ModTab,fill=TRUE)

Expand Down
Binary file modified tests/testthat/testReference/rbind_NMsimRes_01.rds
Binary file not shown.
6 changes: 3 additions & 3 deletions tests/testthat/test_rbind_NMsimRes.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ test_that("Basic",{
fileRef <- "testReference/rbind_NMsimRes_01.rds"
res1 <- NMreadSim("testOutput/NMsim_xgxr021_default_01_paths.rds")

res2 <- res1[,rep:=1]
res2 <- res1[,rep:=2]
res1 <- res1[,rep:=1]
res2 <- copy(res1)[,rep:=2]
class(res1)
r2 <- rbind(res1,res1)
r2 <- rbind.NMsimRes(res1,res2)

expect_equal_to_reference(r2,fileRef)
})

0 comments on commit cdc6bca

Please sign in to comment.