Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
vertesy committed May 7, 2024
1 parent f535461 commit fc3bfba
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 42 deletions.
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cff-version: 1.2.0
title: vertesy/MarkdownReports v4.3.2 Type Less, Plot More. Create (scientific) plots with very little code and write (markdown) reports easily from your R scripts.
version: v4.7.0
version: v4.7.1
message: >-
If you use this software, please cite it using these metadata.
type: software
Expand Down
7 changes: 5 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: MarkdownReports
Title: Generate Scientific Figures and Reports Easily
Version: 4.7.0
Version: 4.7.1
Authors@R:
person("Abel", "Vertesy", , "[email protected]", role = c("aut", "cre"))
Author: Abel Vertesy <[email protected]> [aut, cre]
Expand All @@ -26,11 +26,14 @@ Imports:
clipr,
colorRamps,
gplots,
grid,
pheatmap,
RColorBrewer,
ReadWriter,
sessioninfo,
VennDiagram,
vioplot
Encoding: UTF-8
Packaged: 2023-11-27 00:24:59.961421
Packaged: 2024-05-03 19:06:48.366226
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
4 changes: 2 additions & 2 deletions Development/config.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Configuration for the Package
DESCRIPTION <- list(
package.name = "MarkdownReports",
version = "4.7.0",
version = "4.7.1",
title = "Generate Scientific Figures and Reports Easily",
description = "MarkdownReports is a set of R functions that allows you to generate precise figures easily,
and create clean markdown reports about what you just discovered with your analysis script. It helps you to:
Expand All @@ -12,7 +12,7 @@ DESCRIPTION <- list(
5. Share your report, by exporting your report to .pdf, .html or .docx, or via Github or a personal website.",

depends = "Stringendo, CodeAndRoll2, MarkdownHelpers",
imports = "gplots, RColorBrewer, VennDiagram, vioplot, colorRamps, sessioninfo, clipr, pheatmap, grid ReadWriter",
imports = "gplots, RColorBrewer, VennDiagram, vioplot, colorRamps, sessioninfo, clipr, pheatmap, grid, ReadWriter",
suggests = "",

author.given = "Abel",
Expand Down
74 changes: 37 additions & 37 deletions R/MarkdownReports.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ setup_MarkdownReports <- function(OutDir = getwd(),
OutDir <- ReplaceRepeatedSlashes(OutDir)

print("LOCATIONS ---------------------------")
ww.assign_to_global("OutDir", OutDir, 1, verbose = F)
if (!is.null(newName)) ww.assign_to_global(newName, OutDir, 1, verbose = F)
MarkdownHelpers::ww.assign_to_global("OutDir", OutDir, 1, verbose = F)
if (!is.null(newName)) MarkdownHelpers::ww.assign_to_global(newName, OutDir, 1, verbose = F)

Stringendo::iprint("All files will be saved under 'OutDir': ", OutDir)
path_of_report <- paste0(OutDir, scriptname, ".log.md")
ww.assign_to_global("path_of_report", path_of_report, 1, verbose = FALSE)
MarkdownHelpers::ww.assign_to_global("path_of_report", path_of_report, 1, verbose = FALSE)
Stringendo::iprint(
"MarkdownReport location is stored in 'path_of_report': ",
path_of_report
Expand Down Expand Up @@ -159,7 +159,7 @@ setup_MarkdownReports <- function(OutDir = getwd(),
}
if (!exists(BackupDir) & backupfolder) {
dir.create(BackupDir, showWarnings = FALSE)
ww.assign_to_global("BackupDir", BackupDir, 1, verbose = FALSE)
MarkdownHelpers::ww.assign_to_global("BackupDir", BackupDir, 1, verbose = FALSE)
}
saveParameterList
if (saveParameterList != FALSE) {
Expand All @@ -176,15 +176,15 @@ setup_MarkdownReports <- function(OutDir = getwd(),
}
print("")
print("BACKGROUND VARIABLES (Added to global env.) ---------------------------")
ww.assign_to_global("b.defSize", b.defSize, 1)
ww.assign_to_global("b.defSize.fullpage", b.defSize.fullpage, 1)
ww.assign_to_global("b.mdlink", b.mdlink, 1)
ww.assign_to_global("b.save.wplots", b.save.wplots, 1)
ww.assign_to_global("b.usepng", b.usepng, 1)
ww.assign_to_global("b.png4Github", b.png4Github, 1)
ww.assign_to_global("b.scriptname", scriptname, 1)
ww.assign_to_global("b.def.color", b.def.color, 1)
ww.assign_to_global("b.report.not.found",
MarkdownHelpers::ww.assign_to_global("b.defSize", b.defSize, 1)
MarkdownHelpers::ww.assign_to_global("b.defSize.fullpage", b.defSize.fullpage, 1)
MarkdownHelpers::ww.assign_to_global("b.mdlink", b.mdlink, 1)
MarkdownHelpers::ww.assign_to_global("b.save.wplots", b.save.wplots, 1)
MarkdownHelpers::ww.assign_to_global("b.usepng", b.usepng, 1)
MarkdownHelpers::ww.assign_to_global("b.png4Github", b.png4Github, 1)
MarkdownHelpers::ww.assign_to_global("b.scriptname", scriptname, 1)
MarkdownHelpers::ww.assign_to_global("b.def.color", b.def.color, 1)
MarkdownHelpers::ww.assign_to_global("b.report.not.found",
"Path to the Markdown report file is not defined in path_of_report", 1,
verbose = FALSE
)
Expand Down Expand Up @@ -226,11 +226,11 @@ create_set_SubDir <- function(..., define.ParentDir = TRUE,
if (verbose) Stringendo::iprint("ParentDir was defined as:", ParentDir)
}
if (verbose) Stringendo::iprint("ParentDir will be:", OutDir)
ww.assign_to_global("ParentDir", OutDir, 1)
MarkdownHelpers::ww.assign_to_global("ParentDir", OutDir, 1)
} # if
if (verbose) Stringendo::iprint("Call *create_set_Original_OutDir()* when chaning back to the main dir.")
ww.assign_to_global("OutDir", NewOutDir, 1)
ww.assign_to_global("b.Subdirname", b.Subdirname, 1)
MarkdownHelpers::ww.assign_to_global("OutDir", NewOutDir, 1)
MarkdownHelpers::ww.assign_to_global("b.Subdirname", b.Subdirname, 1)
# Flag that md.image.linker uses
}

Expand All @@ -257,8 +257,8 @@ create_set_Original_OutDir <- function(NewOutDir = OutDirOrig,
if (setDir) {
setwd(NewOutDir)
}
ww.assign_to_global("OutDir", NewOutDir, 1)
ww.assign_to_global("b.Subdirname", b.Subdirname, 1)
MarkdownHelpers::ww.assign_to_global("OutDir", NewOutDir, 1)
MarkdownHelpers::ww.assign_to_global("b.Subdirname", b.Subdirname, 1)
}


Expand All @@ -274,7 +274,7 @@ continue_logging_markdown <- function(b.scriptname) {
path_of_report <-
kollapse(path, b.scriptname, ".log.md", print = FALSE)
Stringendo::iprint("Writing report in:", path_of_report)
ww.assign_to_global("path_of_report", path_of_report, 1)
MarkdownHelpers::ww.assign_to_global("path_of_report", path_of_report, 1)

BackupDir <- kollapse(path,
"/",
Expand All @@ -284,7 +284,7 @@ continue_logging_markdown <- function(b.scriptname) {
)
if (!exists(BackupDir)) {
dir.create(BackupDir, showWarnings = FALSE)
ww.assign_to_global("BackupDir", BackupDir, 1)
MarkdownHelpers::ww.assign_to_global("BackupDir", BackupDir, 1)
}
}

Expand Down Expand Up @@ -312,8 +312,8 @@ create_set_OutDir <- function(..., setDir = TRUE, verbose = TRUE,
if (setDir) {
setwd(OutDir)
}
ww.assign_to_global("OutDir", OutDir, 1)
if (!is.null(newName)) ww.assign_to_global(newName, OutDir, 1)
MarkdownHelpers::ww.assign_to_global("OutDir", OutDir, 1)
if (!is.null(newName)) MarkdownHelpers::ww.assign_to_global(newName, OutDir, 1)
}


Expand Down Expand Up @@ -628,7 +628,7 @@ wplot <- function(df2col,
col = col_abline
)
}
ww.assign_to_global("plotnameLastPlot", fname, 1)
MarkdownHelpers::ww.assign_to_global("plotnameLastPlot", fname, 1)
if (savefile) {
ww.dev.copy(
PNG_ = PNG,
Expand Down Expand Up @@ -837,7 +837,7 @@ wscatter.fill <- function(df2col = cbind("A" = rnorm(100), "B" = rnorm(100)),
if (incrBottMarginBy) {
par("mar" = .ParMarDefault)
}
ww.assign_to_global("plotnameLastPlot", fname, 1)
MarkdownHelpers::ww.assign_to_global("plotnameLastPlot", fname, 1)
if (mdlink & savefile) {
md.image.linker(fname_wo_ext = fname)
}
Expand Down Expand Up @@ -1032,7 +1032,7 @@ wbarplot <- function(variable,
if (incrBottMarginBy) {
par("mar" = .ParMarDefault)
}
ww.assign_to_global("plotnameLastPlot", fname, 1)
MarkdownHelpers::ww.assign_to_global("plotnameLastPlot", fname, 1)
if (mdlink & savefile) {
md.image.linker(fname_wo_ext = fname)
}
Expand Down Expand Up @@ -1176,7 +1176,7 @@ whist <- function(variable,
} else {
Stringendo::iprint(variable, " IS EMPTY")
}
ww.assign_to_global("plotnameLastPlot", fname, 1)
MarkdownHelpers::ww.assign_to_global("plotnameLastPlot", fname, 1)
if (mdlink & savefile) {
md.image.linker(fname_wo_ext = fname)
}
Expand Down Expand Up @@ -1292,7 +1292,7 @@ wboxplot <- function(yourlist,
h_ = h
)
}
ww.assign_to_global("plotnameLastPlot", fname, 1)
MarkdownHelpers::ww.assign_to_global("plotnameLastPlot", fname, 1)
if (incrBottMarginBy) {
par("mar" = .ParMarDefault)
}
Expand Down Expand Up @@ -1541,7 +1541,7 @@ wstripchart <- function(yourlist,
if (incrBottMarginBy) {
par("mar" = .ParMarDefault)
}
ww.assign_to_global("plotnameLastPlot", fname, 1)
MarkdownHelpers::ww.assign_to_global("plotnameLastPlot", fname, 1)
if (mdlink & savefile) {
md.image.linker(fname_wo_ext = fname)
}
Expand Down Expand Up @@ -1686,7 +1686,7 @@ wstripchart_list <- function(yourlist,
if (incrBottMarginBy) {
par("mar" = .ParMarDefault)
}
ww.assign_to_global("plotnameLastPlot", fname, 1)
MarkdownHelpers::ww.assign_to_global("plotnameLastPlot", fname, 1)
if (mdlink & savefile) {
md.image.linker(fname_wo_ext = fname)
}
Expand Down Expand Up @@ -1820,7 +1820,7 @@ wvioplot_list <- function(yourlist,
if (incrBottMarginBy) {
par("mar" = .ParMarDefault)
}
ww.assign_to_global("plotnameLastPlot", fname, 1)
MarkdownHelpers::ww.assign_to_global("plotnameLastPlot", fname, 1)
if (mdlink & savefile) {
md.image.linker(fname_wo_ext = fname)
}
Expand Down Expand Up @@ -1961,7 +1961,7 @@ wviostripchart_list <- function(yourlist,
if (incrBottMarginBy) {
par("mar" = .ParMarDefault)
}
ww.assign_to_global("plotnameLastPlot", fname, 1)
MarkdownHelpers::ww.assign_to_global("plotnameLastPlot", fname, 1)
if (mdlink & savefile) {
md.image.linker(fname_wo_ext = fname)
}
Expand Down Expand Up @@ -2228,9 +2228,9 @@ pdfA4plot_on <- function(plotname = date(),
title = ww.ttl_field(plotname)) {
fname <- ww.FnP_parser(plotname, "pdf")
try.dev.off()
ww.assign_to_global("b.mfrow_def", par("mfrow"), 1)
ww.assign_to_global("b.bg_def", par("bg"), 1)
ww.assign_to_global("b.save.wplots", FALSE, 1) # switch of "savefile" option
MarkdownHelpers::ww.assign_to_global("b.mfrow_def", par("mfrow"), 1)
MarkdownHelpers::ww.assign_to_global("b.bg_def", par("bg"), 1)
MarkdownHelpers::ww.assign_to_global("b.save.wplots", FALSE, 1) # switch of "savefile" option
pdf(
fname,
width = w,
Expand Down Expand Up @@ -2281,8 +2281,8 @@ pdfA4plot_on.layout <- function(plotname = date(),
title = ww.ttl_field(plotname)) {
fname <- ww.FnP_parser(plotname, "pdf")
try.dev.off()
ww.assign_to_global("b.bg_def", par("bg"), 1)
ww.assign_to_global("b.save.wplots", FALSE, 1) # switch of "savefile" option
MarkdownHelpers::ww.assign_to_global("b.bg_def", par("bg"), 1)
MarkdownHelpers::ww.assign_to_global("b.save.wplots", FALSE, 1) # switch of "savefile" option
pdf(
fname,
width = w,
Expand Down Expand Up @@ -2326,7 +2326,7 @@ pdfA4plot_off <- function() {
"white"
}
if (exists("b.save.wplots")) {
ww.assign_to_global("b.save.wplots", TRUE, 1) # switch back mdlink to its original value
MarkdownHelpers::ww.assign_to_global("b.save.wplots", TRUE, 1) # switch back mdlink to its original value
}
par(mfrow = x, bg = y)
try.dev.off() # close pdf
Expand Down

0 comments on commit fc3bfba

Please sign in to comment.