knitxl {knitxl}R Documentation

Knit a Document to an XLSX file

Description

This function takes an input file, extracts the R code in it according to a list of patterns, evaluates the code and writes the output in an XLSX spreadsheet file.

Usage

knitxl(
  input,
  output = NULL,
  text = NULL,
  quiet = FALSE,
  envir = parent.frame(),
  encoding = "UTF-8"
)

Arguments

input

Path to the input file.

output

Path to the output file for knitxl(). If NULL, this function will try to guess a default, which will be under the current working directory.

text

A character vector. This is an alternative way to provide the input file.

quiet

Boolean; suppress the progress bar and messages?

envir

Environment in which code chunks are to be evaluated, for example, parent.frame(), new.env(), or globalenv()).

encoding

Encoding of the input file; always assumed to be UTF-8 (i.e., this argument is effectively ignored).

Value

The compiled document is written into the output file, and the path of the output file is returned invisibly.

Examples

  library(knitxl)
  path_to_input <- system.file("examples", "knitxl-minimal.Rmd", package = "knitxl")
  path_to_output <- "knitxl-minimal.xlsx"
  knitxl(path_to_input, output = path_to_output)  # will generate knitxl-minimal.xlsx
  unlink(path_to_output)


[Package knitxl version 0.1.0 Index]