Commit 263976d5 authored by Jean-Marie Lepioufle's avatar Jean-Marie Lepioufle
Browse files

remove simple plot

parent d1aa1d96
#' plot_tbl_basic
#' plot_tbl_basic
#' @param df tbl_friendlyts data.frame
#' @param target target
#' @param group "none","YEAR","MONTH","WDAY","HOUR","MINUTE","SECOND"
#' @param path path
#' @param name name
#' @param DESKTOP boolean
#' @param width_mm width_mm
#' @param height_mm height_mm
#' @keywords basicr
#' @export
#' @examples
#' \dontrun{
#' plot_tbl_basic()
#' }
plot_tbl_basic <- function(df,target,group,path=tempdir(),name=NULL,DESKTOP=TRUE,width_mm=200,height_mm=200){
if (!DESKTOP) {
filename <- normalizePath(file.path(path,paste0("basic_",group,"_",target,".tiff")),mustWork = FALSE)
grDevices::tiff(filename = filename, width = width_mm, height = height_mm,
units = "mm", pointsize = 12,
compression = "lzw",
bg = "transparent", res = 300)
} else grDevices::dev.new()
names(df)[names(df)==target] <- "targ"
p <- switch(group,
"YEAR" = ggplot2::ggplot(df) + ggplot2::geom_boxplot(ggplot2::aes(x = YEAR, y = targ)) + ggplot2::labs(x = group, y = target),
"MONTH" = ggplot2::ggplot(df) + ggplot2::geom_boxplot(ggplot2::aes(x = MONTH, y = targ)) + ggplot2::labs(x = group, y = target),
"WDAY" = ggplot2::ggplot(df) + ggplot2::geom_boxplot(ggplot2::aes(x = WDAY, y = targ)) + ggplot2::labs(x = group, y = target),
"HOUR" = ggplot2::ggplot(df) + ggplot2::geom_boxplot(ggplot2::aes(x = HOUR, y = targ)) + ggplot2::labs(x = group, y = target),
"MINUTE" = ggplot2::ggplot(df) + ggplot2::geom_boxplot(ggplot2::aes(x = MINUTE, y = targ)) + ggplot2::labs(x = group, y = target),
"SECOND" = ggplot2::ggplot(df) + ggplot2::geom_boxplot(ggplot2::aes(x = SECOND, y = targ)) + ggplot2::labs(x = group, y = target),
stop("group not recognized"))
print(p)
if (!DESKTOP) {
grDevices::dev.off()
print(filename)
} else {}
return(TRUE)
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment