View source: R/updateExpected.R
updateExpected | R Documentation |
This function was created to identify the point at which certain expected values are dropped from a vector. For example, a number of records might "go missing" while performing a series of filtering steps, and you want to identify which step is resulting in their loss. By calling this function after each step, it will report which of the expected values were lost at each point. Further, 'expected' values are removed from what is looked for after they have been lost. In this way, the function can be called numerous times successively, and it will only report the values that were lost at each step (not continue to report all of the lost values at each step).
updateExpected(
df = NULL,
expected = NULL,
known = NULL,
expectedID = NULL,
stepDesc = NULL,
quietly = FALSE
)
df |
default is |
expected |
default is |
known |
default is |
expectedID |
default is |
stepDesc |
default is |
quietly |
default is |
a dataframe, where the first column (expected
) is populated by the submitted
values, and a second column, named using the value of stepDesc
is logical, where 0
indicates that the value was not found within the known
values, and 1 indicates it was
found.
Mike McMahon, Mike.McMahon@dfo-mpo.gc.ca
Other debugging:
changeDetector()
,
where_now()
## Not run:
test <- updateExpected(expected=c("val1","val2","val3"),
known=c("val1","val2","val3", "val4"),
expectedID = "randomvector1",
stepDesc = "example1", quietly = F)
test
expected example1
1 val1 1
2 val2 1
3 val3 1
test2 <- updateExpected(df = test,
expected=c("val1","val2","val3"),
known=c("val1","val2"),
expectedID = "randomvector2",
stepDesc = "example2", quietly = F)
Lost some randomvector3 during example2: val3
test2
expected example1 example2
1 val1 1 1
2 val2 1 1
3 val3 1 0
test3 <- updateExpected(df = test2,
expected=c("val1","val2","val3"),
known=c("val99"),
expectedID = "randomvector3",
stepDesc = "example3", quietly = F)
Lost some randomvector3 during example3: val1, val2
All of the missing vector has now been lost.
test3
expected example1 example2 example3
1 val1 1 1 0
2 val2 1 1 0
3 val3 1 0 0
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.