Skip to content

Commit

Permalink
Add print methods for new classes
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinCCYap committed Apr 20, 2023
1 parent 9b8a061 commit e38fca8
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: flipData
Type: Package
Title: Functions for extracting and describing data
Version: 1.7.0
Version: 1.8.0
Author: Displayr <opensource@displayr.com>
Maintainer: Displayr <opensource@displayr.com>
Description: Functions for extracting data from formulas and
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ S3method(Observed,MachineLearningEnsemble)
S3method(Observed,default)
S3method(print,Calibrate)
S3method(print,MergeDataSetByCase)
S3method(print,MergeDataSetByCasePage)
S3method(print,MergeDataSetByVariable)
S3method(print,MergeDataSetByVariablePage)
S3method(print,StackedData)
export(AddDummyVariablesForNAs)
export(AddFormulaBars)
Expand Down
18 changes: 18 additions & 0 deletions R/mergedatasetsbycase.R
Original file line number Diff line number Diff line change
Expand Up @@ -2663,8 +2663,26 @@ removeNULL <- function(x)
}

#' @importFrom flipFormat DataSetMergingByCaseWidget
#' @param x A list of class MergeDataSetByCase
#' @noRd
#' @export
print.MergeDataSetByCase <- function(x, ...)
{
DataSetMergingByCaseWidget(x$input.data.sets.metadata,
x$merged.data.set.metadata,
x$matched.names,
x$merged.names,
x$omitted.variable.names.list,
x$input.value.attributes.list,
x$is.saved.to.cloud)
}

#' @description Produces a widget output that supports pagination when printing
#' a MergeDataSetByCasePage object.
#' @param x A list of class MergeDataSetByCasePage
#' @noRd
#' @export
print.MergeDataSetByCasePage <- function(x, ...)
{
args <- list(x$input.data.sets.metadata,
x$merged.data.set.metadata,
Expand Down
23 changes: 23 additions & 0 deletions R/mergedatasetsbyvariable.R
Original file line number Diff line number Diff line change
Expand Up @@ -635,3 +635,26 @@ print.MergeDataSetByVariable <- function(x, ...)
x$example.id.values,
x$is.saved.to.cloud)
}

#' @description Produces a widget output that supports pagination when printing
#' a MergeDataSetByVariablePage object.
#' @param x A list of class MergeDataSetByVariablePage
#' @noRd
#' @export
print.MergeDataSetByVariablePage <- function(x, ...)
{
args <- list(x$input.data.sets.metadata,
x$merged.data.set.metadata,
x$source.data.set.indices,
x$omitted.variable.names.list,
x$merged.id.variable.name,
x$id.variable.names,
x$example.id.values,
x$is.saved.to.cloud,
x$page)

if (!is.null(x$variables.per.page))
args <- c(args, x$variables.per.page)

do.call(DataSetMergingByVariableWidget, args)
}

0 comments on commit e38fca8

Please sign in to comment.