Description Usage Arguments Details Functions Examples
A function for testing queries on some data. This function uses the gmp package to match data queries which were asked previously.
1 2 3 4 |
q |
An object of reference class dataQueries |
data |
The database to check is valid |
validation |
a quote object to test with the data |
CRF |
The CRF name (string) |
mess |
The message to return if any data fails the validation |
parameters |
a vector of column names to append to the message (string) |
patid |
Name for the main identifier column. Repeat line can take a second. Any others should be added to parameters. |
repeatLine1, repeatLine2 |
Name of a line reference column when data is in long format with respect to patid |
reject |
Logical should the validation be TRUE or FALSE to report the query? |
prnt |
Logical should the number of failed queries be returned as a message? |
queryQ()
is a shorthand form which means the parameters do not need to be passed to the function. Instead they must be correctly named in the current namespace. This is currently only tested in the global environment and may not work in other environments such as creating .Rmd files.
queryQ
: A short hand version which will find the parameters from the global environment
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | # Create a new queryList
q = queryList()
# use the mtcars data for the example
data = mtcars
data$patid = rownames(data)
CRF = "cars"
reject = TRUE
# first validation
validation = quote(disp > 400)
mess = "Disp too high"
parameters = c("disp")
query(q, data, validation, CRF, mess, parameters)
q$q
# running a query again will not add them again:
query(q, data, validation, CRF, mess, parameters)
# a more complex validation
validation = quote(grepl("Merc",patid) & cyl == 4)
mess = "Merc's cannot have 4 cylinders"
parameters = c("cyl")
# test that the validation is written correctly:
with(data, eval(validation))
query(q, data, validation, CRF, mess, parameters)
# short hand form.
queryQ()
q$q
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.