This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`simulate.gamm` <- function(object, nsim = 1, seed = NULL, newdata, | |
freq = FALSE, unconditional = FALSE, ...) { | |
if (!exists(".Random.seed", envir = .GlobalEnv, inherits = FALSE)) | |
runif(1) | |
if (is.null(seed)) | |
RNGstate <- get(".Random.seed", envir = .GlobalEnv) | |
else { | |
R.seed <- get(".Random.seed", envir = .GlobalEnv) | |
set.seed(seed) | |
RNGstate <- structure(seed, kind = as.list(RNGkind())) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source: http://www.cookbook-r.com/Manipulating_data/Converting_between_data_frames_and_contingency_tables/#countstocases-function | |
# Convert from data frame of counts to data frame of cases. | |
# `countcol` is the name of the column containing the counts | |
countsToCases <- function(x, countcol = "Freq") { | |
# Get the row indices to pull from x | |
idx <- rep.int(seq_len(nrow(x)), x[[countcol]]) | |
# Drop count column | |
x[[countcol]] <- NULL |
NewerOlder