newCollection() can be used to create new collections or add dramas to existing collection files.

newCollection(drama, name = ifelse(inherits(drama, "QDDrama"),
  paste(unique(drama$meta$drama)), paste(drama, collapse = "_")),
  writeToFile = TRUE, dir = getOption("qd.collectionDirectory"),
  append = TRUE)

Arguments

drama

A text (or multiple texts, as data.frame or data.table), or a character vector containing the drama IDs to be collected

name

The name of the collection and its filename (default = concatenated drama IDs)

writeToFile

= Whether to write the collection to a file (default = TRUE)

dir

The directory into which the collection file will be written (default = collection directory)

append

Whether to extend the collection file if it already exists. If FALSE, the file will be overwritten. (default = TRUE)

Value

The function returns the ids that belong to the collection as a character vector.

Examples

t <- combine(rksp.0, rjmw.0) newCollection(t)
#> rksp.0 was written to /Users/reiterns/QuaDramA/Data2/collections
#> [1] "rksp.0" "rjmw.0"
newCollection(c("rksp.0", "rjmw.0"), append=FALSE) # produces identical file
#> rksp.0_rjmw.0 was written to /Users/reiterns/QuaDramA/Data2/collections
#> [1] "rksp.0" "rjmw.0"
newCollection(c("a", "b"), name="rksp.0_rjmw.0") # adds "a" and "b" to the file
#> rksp.0_rjmw.0 was written to /Users/reiterns/QuaDramA/Data2/collections
#> [1] "rksp.0" "rjmw.0" "a" "b"