Skip to content

Instantly share code, notes, and snippets.

@definitelysean
Created November 9, 2018 17:02
Show Gist options
  • Save definitelysean/a86bfa79fc1c5ada8ad9e6c5648765b7 to your computer and use it in GitHub Desktop.
Save definitelysean/a86bfa79fc1c5ada8ad9e6c5648765b7 to your computer and use it in GitHub Desktop.
Append two celda_list objects (from S3 version of celda)
appendCeldaList = function(celda.list.one, celda.list.two) {
if (!is(celda.list.one, "celda_list") || !is(celda.list.two, "celda_list")) {
stop("Both arguments must be of class \"celda_list\"")
}
if (celda.list.one$content.type != celda.list.two$content.type) {
stop("Both arguments must have same content.type attribute")
}
if (celda.list.one$count.checksum != celda.list.two$count.checksum) {
warning("count.checksum property on arguments do not match. Using checksum from first list.")
}
new.celda.list = list(run.params=rbind(celda.list.one$run.params, celda.list.two$run.params),
res.list=c(celda.list.one$res.list, celda.list.two$res.list),
content.type=celda.list.one$content.type,
count.checksum=celda.list.one$count.checksum)
return(new.celda.list)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment