Description Usage Arguments Details Value Author(s) See Also Examples
Returns a function that will re-apply the transformations that have been applied to a CausataData obejct to another data frame.
1 2 | ## S3 method for class 'CausataData'
GetTransforms(this, ...)
|
this |
A |
... |
Unused extra arguments. |
As transformations are applied to the CausataData object, they are recorded. This function returns a function that will apply these transformations, in order, as they were applied to the data frame in the CausataData object. This can be used to validate that transformations work as expected on new data, and are used in model validation.
A function that accepts a data.frame as an argument and returns a transformed data.frame.
David Barker (support@causata.com)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # Create a data frame with a factor that has 5 levels.
df <- data.frame(var__AP=c("a", "a", "a", "b", "b", "c", "d", "e", NA))
caustaData <- CausataData(df, rep(0,nrow(df)))
# Merge the smaller levels so the factor has 3 levels.
# The remaining levels will be a, b, and Other.
caustaData <- MergeLevels(caustaData, max.levels=3)
# Get a function that will re-apply any transformations in caustaData.
transformer <- GetTransforms(caustaData)
# Now, create a new data.frame and apply the same transformation to it.
# Any levels in the factor that are not "a", or "b" will be replaced
# with "Other"
new.df <- data.frame(var__AP=c("a", "b", "c", "c", "c", "d", "a", NA))
transformed.df <- transformer(new.df)
transformed.df$var__AP
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.