R/TableWare-R6.R

#' @title A Set of Table Operation for Data Curation
#'
#' @description Given \code{table} and \code{table_profile} created by
#'   \code{\link{TableProfiler}}, when \code{TableWare$new(table,
#'   table_profile)} is called, then a set of data quality functions become
#'   available.
#'
#' @return (`TableWare`) An object with the table and a set of data quality
#'   operations that can be applied to that table.
#'
#' @export
#'
#' @examples
#' \dontrun{
#' mtcars_profile <- TableProfiler$new(mtcars)$profile
#' mtcars_tools <- TableWare$new(mtcars, mtcars_profile)
#' mtcars_tools$table
#' }
#'
TableWare <- R6::R6Class(
    classname = "TableWare",
    public = list(
        ## Public Methods
        initialize = function(table, table_profile){
            .assert_is_a_valid_profile(table, table_profile)
            private$.table <- table
            private$.table_profile <- table_profile
        },
        convert_col_types = function() .convert_col_types(private$.table, private$.table_profile)
    ),
    private = list(
        ## Private Variables
        .table = data.frame(),
        .table_profile = data.frame()
        ## Private Methods
    ),
    active = list(table = function() return(private$.table))
)# end R6
tidylab/tableware documentation built on July 6, 2019, 1:12 a.m.