Skip to content

Commit 22e79a9

Browse files
committed
Add view_output()
Function to view the output table with rounded numbers
1 parent 486472f commit 22e79a9

3 files changed

Lines changed: 33 additions & 0 deletions

File tree

NAMESPACE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export(saveActiveDevice)
3030
export(site_info_from_qsimID)
3131
export(stats)
3232
export(value_to_classes)
33+
export(view_output)
3334
import(ggmap)
3435
importFrom(data.table,fread)
3536
importFrom(geosphere,distHaversine)
@@ -55,6 +56,7 @@ importFrom(methods,is)
5556
importFrom(png,readPNG)
5657
importFrom(stats,quantile)
5758
importFrom(stats,sd)
59+
importFrom(utils,View)
5860
importFrom(utils,data)
5961
importFrom(utils,read.table)
6062
importFrom(utils,unstack)

R/utils.R

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,3 +278,18 @@ classes_to_color <- function(class_levels, colorVector = NULL){
278278
factor(colorVector, levels = colorVector)
279279
}
280280

281+
282+
#' View the output table with rounded results
283+
#'
284+
#' @param ot The output table created with one of the aggregating functions
285+
#' @param digits The number of digits
286+
#'
287+
#' @importFrom utils View
288+
#' @export
289+
#'
290+
view_output <- function(ot, digits){
291+
output_region <-
292+
!(colnames(ot) %in% c("river_name", "section_id", "section_name", "km"))
293+
ot[,output_region] <- round(ot[,output_region], digits = 3)
294+
View(ot)
295+
}

man/view_output.Rd

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)