inst/doc/standard_usage.R

## ----setup, include = FALSE---------------------------------------------------
knitr::opts_chunk$set(
  collapse = FALSE,
  comment = "#>",
  eval=TRUE
)

## ---- eval=FALSE--------------------------------------------------------------
#  if(!requireNamespace("BiocManager", quietly = TRUE))
#      install.packages("BiocManager")
#  BiocManager::install("easyreporting")

## -----------------------------------------------------------------------------
library("easyreporting")

## -----------------------------------------------------------------------------
proj.path <- file.path(tempdir(), "bioinfo_report")
er <- easyreporting(filenamePath=proj.path, title="example_report",
                        author=c("Dario Righelli"))

## -----------------------------------------------------------------------------
mkdTitle(er, title="Code Chunks", level=1)

mkdGeneralMsg(er, "A simple paragraph useful to describe my code chunk...")

## -----------------------------------------------------------------------------
mkdTitle(er, title="Manual code chunk", level=2)

mkdCodeChunkSt(er)
variable <- 1
mkdVariableAssignment(er, "variable", `variable`, show=TRUE)
mkdCodeChunkEnd(er)

## -----------------------------------------------------------------------------
optList <- makeOptionsList(echoFlag=TRUE, includeFlag=TRUE)
mkdCodeChunkSt(er, optionList=optList)
mkdCodeChunkEnd(er)

## -----------------------------------------------------------------------------
## moreover I can add a list of files to source in che code chunk
RFilesList <- list.files(system.file("script", package="easyreporting"), 
                        full.names=TRUE)
mkdCodeChunkSt(er, optionList=optList, sourceFilesList=RFilesList)
mkdGeneralMsg(er, message="v <- fakeFunction(10)")
mkdCodeChunkEnd(er)

## -----------------------------------------------------------------------------
mkdCodeChunkComplete(er, message="v <- fakeFunction(11)")

## -----------------------------------------------------------------------------
optList <- makeOptionsList(includeFlag=TRUE, cacheFlag=TRUE)

mkdCodeChunkCommented(er, 
                commentMsg="This is the comment of the following code chunk",
                codeMsg="v <- fakeFunction(12)",
                optionList=optList,
                sourceFilesList=NULL)

## -----------------------------------------------------------------------------
compile(er)

## -----------------------------------------------------------------------------
sessionInfo()

Try the easyreporting package in your browser

Any scripts or data that you put into this service are public.

easyreporting documentation built on Nov. 8, 2020, 8:01 p.m.