Skip to content

Commit

Permalink
Fix tail warnings. make all print and show methods silently return obj.
Browse files Browse the repository at this point in the history
  • Loading branch information
gmbecker committed Dec 17, 2020
1 parent 1db83eb commit cb16bee
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 3 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ importFrom(stats,prop.test)
importFrom(stats,quantile)
importFrom(stats,relevel)
importFrom(stats,setNames)
importFrom(utils,compareVersion)
importFrom(utils,head)
importFrom(utils,head.matrix)
importFrom(utils,tail)
Expand Down
2 changes: 2 additions & 0 deletions R/00tabletrees.R
Original file line number Diff line number Diff line change
Expand Up @@ -1553,6 +1553,7 @@ CellValue = function(val, format = NULL, colspan = 1L, label = NULL, indent_mod
#' @export
print.CellValue <- function(x, ...) {
cat(paste("rcell:", format_rcell(x), "\n"))
invisible(x)
}

## too slow
Expand Down Expand Up @@ -1602,6 +1603,7 @@ print.RowsVerticalSection <- function(x, ...) {
stringsAsFactors = FALSE,
row.names = NULL
), row.names = TRUE)
invisible(x)
}


Expand Down
7 changes: 6 additions & 1 deletion R/tt_pos_and_access.R
Original file line number Diff line number Diff line change
Expand Up @@ -809,10 +809,15 @@ extract_colvals = function(tt, j) {

}

#' @importFrom utils compareVersion

setGeneric("tail", tail)
setMethod("tail", "VTableTree",
function(x, n = 6L, ...) {
tail.matrix(x, n, addrownums = FALSE)
if(compareVersion("4.0.0", as.character(getRversion())) <= 0)
tail.matrix(x, n, keepnums = FALSE)
else
tail.matrix(x, n, addrownums = FALSE)
})

setGeneric("head", head)
Expand Down
9 changes: 7 additions & 2 deletions R/tt_showmethods.R
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,15 @@ setMethod("show", "PreDataColLayout",
function(object) {
cat("A Pre-data Column Layout Object\n\n")
docat_predataxis(object)
invisible(object)
})


setMethod("show", "PreDataRowLayout",
function(object) {
cat("A Pre-data Row Layout Object\n\n")
docat_predataxis(object)
invisible(object)
})


Expand All @@ -225,6 +227,7 @@ setMethod("show", "PreDataTableLayouts",
cat("\nRow-Split Structure:\n")
docat_predataxis(object@row_layout)
cat("\n")
invisible(object)
})


Expand All @@ -238,6 +241,7 @@ setMethod("show", "TreePos",

msg = paste(chars, collapse = " -> ")
cat("An object of class ", class(object), "\n\n", msg)
invisible(object)
})


Expand All @@ -253,7 +257,6 @@ setMethod("show", "InstantiatedColumnInfo",
collapse = ", ")),
"",
sep = "\n")

invisible(object)
})

Expand All @@ -267,7 +270,8 @@ setMethod("print", "VTableTree", function(x, ...) {

#' @rdname int_methods
setMethod("show", "VTableTree", function(object) {
cat(toString(object))
cat(toString(object))
invisible(object)
})


Expand All @@ -278,4 +282,5 @@ setMethod("show", "TableRow", function(object) {
obj_label(object),
paste(as.vector(get_formatted_cells(object)),
collapse = " ")))
invisible(object)
})
37 changes: 37 additions & 0 deletions man/cell_values.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cb16bee

Please sign in to comment.