Skip to contents

Captures an R expression unevaluated and renders it as a single shell-quoted R -e '...' string, suitable for a Dockerfile $RUN() directive.

Usage

r(code)

Arguments

code

an R expression (captured unevaluated) to wrap.

Value

a length-1 character string of the form R -e '...', shell-quoted with base::shQuote().

Examples

r(print("yeay"))
#> R -e 'print("yeay")'
r(install.packages("plumber", repos = "https://cloud.r-project.org"))
#> R -e 'install.packages("plumber", repos = "https://cloud.r-project.org")'