Skip to content

Commit

Permalink
rename .time variable to time_vec in .sim_network_bp to fix pkgdown f…
Browse files Browse the repository at this point in the history
…ailure
  • Loading branch information
joshwlambert committed Feb 19, 2025
1 parent 2c9faff commit d31ffb6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions R/sim_network_bp.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@
ancestor <- vector(mode = "integer", 1e5)
generation <- vector(mode = "integer", 1e5)
infected <- vector(mode = "integer", 1e5)
.time <- vector(mode = "double", 1e5)
time_vec <- vector(mode = "double", 1e5)

# store initial individual
ancestor[1] <- NA_integer_
generation[1] <- 1L
# 1 is infected, 0 is non-infected contact
infected[1] <- 1L
.time[1] <- 0
time_vec[1] <- 0

# initialise counters
next_gen_size <- 1L
Expand Down Expand Up @@ -86,7 +86,7 @@
ancestor <- c(ancestor, vector(mode = "integer", 1e5))
generation <- c(generation, vector(mode = "integer", 1e5))
infected <- c(infected, vector(mode = "integer", 1e5))
.time <- c(.time, vector(mode = "double", 1e5))
time_vec <- c(time_vec, vector(mode = "double", 1e5))
}

generation[vec_idx] <- chain_generation
Expand All @@ -111,7 +111,7 @@
min = 0,
max = contact_infectious_period
)
.time[vec_idx] <- contact_times + .time[ancestor_idx[i]]
time_vec[vec_idx] <- contact_times + time_vec[ancestor_idx[i]]
}
}
ancestor_idx <- setdiff(which(infected == 1), prev_ancestors)
Expand Down Expand Up @@ -140,14 +140,14 @@
# if the outcome names are changed, please find and update all
# logical expressions, e.g., x == "infected" or x == "contact"
infected <- ifelse(test = infected, yes = "infected", no = "contact")
.time <- .time[seq_along(generation)]
time_vec <- time_vec[seq_along(generation)]

# return chain as <data.frame>
data.frame(
id = id,
ancestor = ancestor,
generation = generation,
infected = infected,
time = .time
time = time_vec
)
}

0 comments on commit d31ffb6

Please sign in to comment.