Skip to contents

Deprecated batches are removed from the online database but not from local data files. This function fetches a list of deprecated batches (stored in the 'deprecated' table), and, optionally, removes these batches from all tables that reference batchIDs


deprecateBatches(src, fetchOnly = FALSE, ask = TRUE)



SQLite connection (result of tagme(XXX) or DBI::dbConnect(RSQLite::SQLite(), "XXX.motus"))


Logical. Only fetch batches that are deprecated. Don't remove deprecated batches from other tables.


Logical. Ask for confirmation when removing deprecated batches


# Download and access data from project 176 in sql format
if (FALSE) {
# usename and password are both "motus.sample"
sql.motus <- tagme(176, new = TRUE, update = TRUE)

# OR use example sql file included in `motus`
sql.motus <- tagme(176, update = FALSE, 
                   dir = system.file("extdata", package = "motus"))
# Access 'deprecated' table using tbl() from dplyr
tbl(sql.motus, "deprecated")

# See that there are deprecated batches in the data
filter(tbl(sql.motus, "alltags"), batchID == 6000)

# Fetch deprecated batches
deprecateBatches(sql.motus, fetchOnly = TRUE)

# Remove deprecated batches (will ask for confirmation unless ask = FALSE)
deprecateBatches(sql.motus, ask = FALSE)

# See that there are NO more deprecated batches in the data
filter(tbl(sql.motus, "alltags"), batchID == 6000)