Description Usage Arguments Details Value See Also
Watch data is returned in a list with one element per step of the function evaluation, which is awkward if we want to manipulate the data across steps. This function will simplify variables that are either missing or always of the same type according to the following rules:
1 | simplify_data(dat)
|
dat |
list the "watch.data" attribute as produced by a |
Scalar values are turned into vectors and returned as a column of the ".scalar" data.frame member of the result. Variables that are not defined at every step of the evaluation will be recorded as NA for those steps.
Vectors are turned into data frames with columns .id
, .line
added.
Matrices are turned into data frames with columns .id
, .line
, x, y,
val, where .id
is the step id and .line
is the code line number.
Data frames are rbinded and gain .id and .line variables, if those variables already exist they will be over-written.
Variables that change types are just stored in their original format in the list, except for scalars that change to vectors and vice versa, which are treated as vectors.
Not optimized for speed.
Due to the use of the ".scalar", ".id", and ".line" symbols as part of the simplification, the simplification will fail if the watched function contains those symbols. No effort is made to check for that condition.
list with elements '.scalar' which is a data frame of all the scalar variables with one row per step of the function evaluation, and additionally, one element per matrix/data.frame variable, and one list element for each of all the other variables. Except for the ".scalar" element, each top-level element of the return value retains the name of the variable it corresponds to.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.