Passer au contenu

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

Utilisation

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

Arguments

src

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

fetchOnly

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

ask

Logical. Ask for confirmation when removing deprecated batches

Exemples


# 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
library(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)
}