inspector | R Documentation |
Data police
inspector(x)
x |
a data.table with its (S3) class extended by the database table name (see server.R) |
Inspectors are S3 functions that usually return the results of several validators
require(data.table)
require(DataEntry.validation)
x <- data.table(
v1 = c(NA, NA, as.character(Sys.time() - 3600 * 24 * 10)),
datetime_ = c("2016-11-23 25:23", as.character(Sys.time() - 100), as.character(Sys.time() + 100))
)
x[, rowid := .I]
class(x) <- c(class(x), "tablex")
inspector.tablex <- function(x) {
list(
# first validator
x[, .(datetime_)] |> POSIXct_validator()
,
# second validator
is.na_validator(x)
,
# faulty validator
nrow(x) |> try_validator(nam = 'wrong output')
)
}
inspector(x) |> evalidators()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.