Rmarkdown partial example

Introduction

For example, you can make enlarge-able plots:

Graphical relationship

library(rmdpartials)
library(ggplot2)
x <- rnorm(100)
y <- x + rnorm(100) + 0.5 * x^2
curve <- qplot(x, y)
## Warning: `qplot()` was deprecated in ggplot2 3.4.0.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
enlarge_plot(curve, large_plot = curve + theme_classic(base_size = 20), plot_name = "myplot")

Regression

reg <- lm(y ~ x)
regression_diagnostics(reg)
x
(Intercept) 0.3592409
x 1.0755503

Values vs. fitted values.

Diagnostics (click to show)

Write a partial on the fly

x <- 5
y <- 9
partial(text = "`r x` `r y`")

5 9

Debug

Learn about environments in partials.

knit_child_debug()
Debug

Working directory

## [1] "/tmp/Rtmp6zUshY/Rbuildf8d41f3f353/rmdpartials/vignettes"

needs_preview()

## [1] FALSE

is_interactive()

## [1] FALSE

Knitr Output.dir

## [1] "/tmp/Rtmp6zUshY/Rbuildf8d41f3f353/rmdpartials/vignettes"

Child mode

## [1] TRUE

Viewer null

## [1] TRUE

In tmp dir

## [1] FALSE

knitr.in.progress

## [1] TRUE

rstudio.notebook.executing

## NULL

TESTTHAT_interactive

## [1] ""

TESTTHAT

## [1] ""

interactive

## [1] FALSE

objects in this environment

## [1] "is_interactive" "needs_preview"
knitr::opts_knit
## $progress
## [1] FALSE
## 
## $verbose
## [1] FALSE
## 
## $eval.after
## [1] "fig.cap"  "fig.scap" "fig.alt" 
## 
## $base.dir
## NULL
## 
## $base.url
## NULL
## 
## $root.dir
## NULL
## 
## $child.path
## [1] ""
## 
## $upload.fun
## function (x) 
## x
## <bytecode: 0x55b96b258c48>
## <environment: namespace:base>
## 
## $global.device
## [1] FALSE
## 
## $global.par
## [1] FALSE
## 
## $concordance
## [1] FALSE
## 
## $documentation
## [1] 1
## 
## $self.contained
## [1] TRUE
## 
## $unnamed.chunk.label
## [1] "rmdpartial"
## 
## $highr.opts
## NULL
## 
## $label.prefix
##  table 
## "tab:" 
## 
## $latex.tilde
## NULL
## 
## $out.format
## [1] "markdown"
## 
## $child
## [1] TRUE
## 
## $parent
## [1] FALSE
## 
## $tangle
## [1] FALSE
## 
## $aliases
## NULL
## 
## $header
## highlight      tikz    framed 
##        ""        ""        "" 
## 
## $global.pars
## NULL
## 
## $rmarkdown.pandoc.from
## [1] "markdown+autolink_bare_uris+tex_math_single_backslash"
## 
## $rmarkdown.pandoc.to
## [1] "html"
## 
## $rmarkdown.pandoc.args
##  [1] "--embed-resources"                                                  
##  [2] "--standalone"                                                       
##  [3] "--section-divs"                                                     
##  [4] "--table-of-contents"                                                
##  [5] "--toc-depth"                                                        
##  [6] "2"                                                                  
##  [7] "--template"                                                         
##  [8] "/usr/local/lib/R/site-library/buildtools/rmd-template/template.html"
##  [9] "--highlight-style"                                                  
## [10] "pygments"                                                           
## 
## $rmarkdown.pandoc.id_prefix
## [1] ""
## 
## $rmarkdown.keep_md
## [1] FALSE
## 
## $rmarkdown.df_print
## [1] "default"
## 
## $rmarkdown.version
## [1] 2
## 
## $rmarkdown.runtime
## [1] "static"
## 
## $output.dir
## [1] "/tmp/Rtmp6zUshY/Rbuildf8d41f3f353/rmdpartials/vignettes"
knitr::opts_chunk
## $eval
## [1] TRUE
## 
## $echo
## [1] FALSE
## 
## $results
## [1] "markup"
## 
## $tidy
## [1] FALSE
## 
## $tidy.opts
## NULL
## 
## $collapse
## [1] FALSE
## 
## $prompt
## [1] FALSE
## 
## $comment
## [1] "##"
## 
## $highlight
## [1] TRUE
## 
## $size
## [1] "normalsize"
## 
## $background
## [1] "#F7F7F7"
## 
## $strip.white
## [1] TRUE
## 
## $cache
## [1] FALSE
## 
## $cache.path
## [1] "rmdpartials_cache/html/f080a7cff6_"
## 
## $cache.vars
## NULL
## 
## $cache.lazy
## [1] TRUE
## 
## $dependson
## NULL
## 
## $autodep
## [1] FALSE
## 
## $cache.rebuild
## [1] FALSE
## 
## $fig.keep
## [1] "high"
## 
## $fig.show
## [1] "asis"
## 
## $fig.align
## [1] "default"
## 
## $fig.path
## [1] "/tmp/Rtmp6zUshY/Rbuildf8d41f3f353/rmdpartials/vignettes/rmdpartials_files/figure-html/f080a7cff6_"
## 
## $dev
## [1] "png"
## 
## $dev.args
## NULL
## 
## $dpi
## [1] 96
## 
## $fig.ext
## NULL
## 
## $fig.width
## [1] 7
## 
## $fig.height
## [1] 5
## 
## $fig.env
## [1] "figure"
## 
## $fig.cap
## NULL
## 
## $fig.scap
## NULL
## 
## $fig.lp
## [1] "fig:"
## 
## $fig.subcap
## NULL
## 
## $fig.pos
## [1] ""
## 
## $out.width
## NULL
## 
## $out.height
## NULL
## 
## $out.extra
## NULL
## 
## $fig.retina
## [1] 2
## 
## $external
## [1] TRUE
## 
## $sanitize
## [1] FALSE
## 
## $interval
## [1] 1
## 
## $aniopts
## [1] "controls,loop"
## 
## $warning
## [1] TRUE
## 
## $error
## [1] FALSE
## 
## $message
## [1] TRUE
## 
## $render
## NULL
## 
## $ref.label
## NULL
## 
## $child
## NULL
## 
## $engine
## [1] "R"
## 
## $split
## [1] FALSE
## 
## $include
## [1] TRUE
## 
## $purl
## [1] TRUE
Sys.getenv()
## ACTIONS_CACHE_URL       https://acghubeus1.actions.githubusercontent.com/omt6dxfQTJ8RpLxaIXwd44hCyK3nU2prEqgl4YBMcRj8yg7Tmj/
## ACTIONS_RESULTS_URL     https://results-receiver.actions.githubusercontent.com/
## ACTIONS_RUNTIME_TOKEN   eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Ikh5cTROQVRBanNucUM3bWRydEFoaHJDUjJfUSJ9.eyJuYW1laWQiOiJkZGRkZGRkZC1kZGRkLWRkZGQtZGRkZC1kZGRkZGRkZGRkZGQiLCJzY3AiOiJBY3Rpb25zLkdlbmVyaWNSZWFkOjAwMDAwMDAwLTAwMDAtMDAwMC0wMDAwLTAwMDAwMDAwMDAwMCBBY3Rpb25zLlJlc3VsdHM6OTBlOTAyYzYtZTA2MS00Yzc1LWIwZWUtNW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250ZW50LmNvbXx2c286NjZkNDliNjktMjhhYi00NDE5LTgxNDAtNjNlMzMyMGVjZTg5IiwibmJmIjoxNzMxMDM2NTcwLCJleHAiOjE3MzEwNDMxNzB9.Wy1b8btgx61-JM-EQXzH_TIGWUloJTS5YWX6WaScmHWe3ZrJ_GGGNF5czMa5fG_3AGwYKbd5PwGFLtExYUemJeeFvKG3ax63STXbkkqAKudco4Cn28dTSTY4w27N-7DdTysjcShRrfqwmw9iWkRURdl8nUjjC450LGQoYT5Q83dwt6fhWyCfaASCOE9oDXYN0J8m7AisIijrOs6qV-37YP9Vcw5V_qHXxmjjAvq_s-nH7wOagfqfgVQsaNK-09AoTmyFdlolr-uwCXOUVgz_Oc6uKmZ3u4W5GSF4KdaU5M2Isst0GGjqq4nZ34f1DvlngmoaAxay4TbfTwG5YfhgKQ
## ACTIONS_RUNTIME_URL     https://pipelinesghubeus25.actions.githubusercontent.com/omt6dxfQTJ8RpLxaIXwd44hCyK3nU2prEqgl4YBMcRj8yg7Tmj/
## ARROW_R_DEV             true
## BIBINPUTS               .:/usr/share/R/share/texmf/bibtex/bib:
## BSTINPUTS               .:/usr/share/R/share/texmf/bibtex/bst:
## CARGO_HOME              /opt/.cargo
## DEBIAN_FRONTEND         noninteractive
## DISABLE_STATIC_LIBV8    1
## DISPLAY                 :6
## DUMMY_SESSION           135lTkNxcDyEyN2OrINHuzOyD6mbYr9Ay6O3HGb1ou0qV13l
## EDITOR                  vi
## GH_APP_ID               87942
## GITHUB_ACTION           build
## GITHUB_ACTION_REF       master
## GITHUB_ACTION_REPOSITORY
##                         r-universe-org/build-source
## GITHUB_ACTOR            ropensci-bot
## GITHUB_ACTOR_ID         50079005
## GITHUB_API_URL          https://api.github.com
## GITHUB_BASE_REF         
## GITHUB_ENV              /github/file_commands/set_env_e9e9fdac-ed8c-4c51-b5f2-c9a4119227b2
## GITHUB_EVENT_NAME       workflow_dispatch
## GITHUB_EVENT_PATH       /github/workflow/event.json
## GITHUB_GRAPHQL_URL      https://api.github.com/graphql
## GITHUB_HEAD_REF         
## GITHUB_JOB              source
## GITHUB_OUTPUT           /github/file_commands/set_output_e9e9fdac-ed8c-4c51-b5f2-c9a4119227b2
## GITHUB_PAT              ghs_ruo7jYoWhQD4ZDEBnrWUQzehB3WpS82qBU5X
## GITHUB_PATH             /github/file_commands/add_path_e9e9fdac-ed8c-4c51-b5f2-c9a4119227b2
## GITHUB_REF              refs/heads/master
## GITHUB_REF_NAME         master
## GITHUB_REF_PROTECTED    false
## GITHUB_REF_TYPE         branch
## GITHUB_REPOSITORY       r-universe/rforms
## GITHUB_REPOSITORY_ID    603051393
## GITHUB_REPOSITORY_OWNER
##                         r-universe
## GITHUB_REPOSITORY_OWNER_ID
##                         56591987
## GITHUB_RETENTION_DAYS   90
## GITHUB_RUN_ATTEMPT      1
## GITHUB_RUN_ID           11735670080
## GITHUB_RUN_NUMBER       394
## GITHUB_SERVER_URL       https://github.com
## GITHUB_SHA              c8572565d5ddb76832a7b95df13281055ab7db35
## GITHUB_STATE            /github/file_commands/save_state_e9e9fdac-ed8c-4c51-b5f2-c9a4119227b2
## GITHUB_STEP_SUMMARY     /github/file_commands/step_summary_e9e9fdac-ed8c-4c51-b5f2-c9a4119227b2
## GITHUB_TRIGGERING_ACTOR
##                         ropensci-bot
## GITHUB_WORKFLOW         Build package
## GITHUB_WORKFLOW_REF     r-universe/rforms/.github/workflows/build.yml@refs/heads/master
## GITHUB_WORKFLOW_SHA     c8572565d5ddb76832a7b95df13281055ab7db35
## GITHUB_WORKSPACE        /github/workspace
## HOME                    /github/home
## HOSTNAME                26611799033c
## INPUT_ARTICLES          
## INPUT_BRANCH            
## INPUT_REF               a635ef9738c219ce4ac4c354888a69fe7e8c3969
## INPUT_SUBDIR            
## INPUT_URL               https://github.com/rubenarslan/rmdpartials
## LANG                    en_US.UTF-8
## LC_COLLATE              C
## LD_LIBRARY_PATH         /usr/lib/R/lib:/usr/lib/x86_64-linux-gnu:/usr/lib/jvm/default-java/lib/server:/usr/lib/R/lib:/usr/lib/x86_64-linux-gnu:/usr/lib/jvm/default-java/lib/server:/usr/lib/R/lib:/usr/lib/x86_64-linux-gnu:/usr/lib/jvm/default-java/lib/server
## LN_S                    ln -s
## MAINTAINERLOGIN         rubenarslan
## MAINTAINERUUID          831109
## MAKE                    make
## MY_UNIVERSE             https://rforms.r-universe.dev
## PAGER                   /usr/bin/pager
## PATH                    /usr/lib/R/bin:/root/bin:/opt/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
## PDFLATEX                pdftinytex
## PWD                     /tmp/Rtmp6zUshY/Rbuildf8d41f3f353/rmdpartials
## RGL_USE_NULL            TRUE
## RUNNER_ARCH             X64
## RUNNER_ENVIRONMENT      github-hosted
## RUNNER_NAME             GitHub Actions 405
## RUNNER_OS               Linux
## RUNNER_TEMP             /home/runner/work/_temp
## RUNNER_TOOL_CACHE       /opt/hostedtoolcache
## RUNNER_WORKSPACE        /home/runner/work/rforms
## RUSTUP_HOME             /opt/.rustup
## R_ARCH                  
## R_BIOC_VERSION          3.20
## R_BROWSER               echo
## R_BUILD_TEMPLIB         /tmp/Rtmp6zUshY/Rinstf8d62c1221e
## R_BZIPCMD               /bin/bzip2
## R_CMD                   /usr/lib/R/bin/Rcmd
## R_DEFAULT_PACKAGES      
## R_DOC_DIR               /usr/share/R/doc
## R_ENVIRON               
## R_ENVIRON_USER          
## R_GZIPCMD               /bin/gzip -n
## R_HOME                  /usr/lib/R
## R_INCLUDE_DIR           /usr/share/R/include
## R_LIBS                  /tmp/Rtmp6zUshY/Rinstf8d62c1221e
## R_LIBS_SITE             /usr/local/lib/R/site-library:/usr/lib/R/site-library
## R_LIBS_USER             /github/workspace/pkglib
## R_OSTYPE                unix
## R_PAPERSIZE             letter
## R_PAPERSIZE_USER        letter
## R_PDFVIEWER             echo
## R_PLATFORM              x86_64-pc-linux-gnu
## R_PRINTCMD              /usr/bin/lpr
## R_PROFILE               
## R_PROFILE_USER          
## R_RD4PDF                times,inconsolata,hyper
## R_SESSION_TMPDIR        /tmp/RtmpCRzK5M
## R_SHARE_DIR             /usr/share/R/share
## R_STRIP_SHARED_LIB      strip --strip-unneeded
## R_STRIP_STATIC_LIB      strip --strip-debug
## R_TESTS                 /tmp/vignettehack.R
## R_TEXI2DVICMD           emulation
## R_UNZIPCMD              /usr/bin/unzip
## R_VERSION               4.4.2
## R_ZIPCMD                /usr/bin/zip
## SED                     /bin/sed
## SHLVL                   1
## TAR                     /bin/tar
## TEXINPUTS               .:/usr/share/R/share/texmf/tex/latex:
## UNIVERSE_NAME           rforms
## USE_SYSTEM_LIBGIT2      1
## _R_SHLIB_STRIP_         true
options()
## $CBoundsCheck
## [1] FALSE
## 
## $HTTPUserAgent
## [1] "R (4.4.2 x86_64-pc-linux-gnu x86_64 linux-gnu)"
## 
## $OutDec
## [1] "."
## 
## $PCRE_limit_recursion
## [1] NA
## 
## $PCRE_study
## [1] FALSE
## 
## $PCRE_use_JIT
## [1] TRUE
## 
## $add.smooth
## [1] TRUE
## 
## $bitmapType
## [1] "cairo"
## 
## $browser
## [1] "echo"
## 
## $browserNLdisabled
## [1] FALSE
## 
## $callr.condition_handler_cli_message
## function (msg) 
## {
##     custom_handler <- getOption("cli.default_handler")
##     if (is.function(custom_handler)) {
##         custom_handler(msg)
##     }
##     else {
##         cli_server_default(msg)
##     }
## }
## <bytecode: 0x55b969033d28>
## <environment: namespace:cli>
## 
## $catch.script.errors
## [1] FALSE
## 
## $check.bounds
## [1] FALSE
## 
## $citation.bibtex.max
## [1] 1
## 
## $continue
## [1] "+ "
## 
## $contrasts
##         unordered           ordered 
## "contr.treatment"      "contr.poly" 
## 
## $defaultPackages
## [1] "datasets"  "utils"     "grDevices" "graphics"  "stats"     "methods"  
## 
## $demo.ask
## [1] "default"
## 
## $deparse.cutoff
## [1] 60
## 
## $device
## function (width = 7, height = 7, ...) 
## {
##     grDevices::pdf(NULL, width, height, ...)
## }
## <bytecode: 0x55b96b334558>
## <environment: namespace:knitr>
## 
## $device.ask.default
## [1] FALSE
## 
## $digits
## [1] 7
## 
## $dplyr.show_progress
## [1] TRUE
## 
## $dvipscmd
## [1] "dvips"
## 
## $echo
## [1] FALSE
## 
## $editor
## [1] "vi"
## 
## $encoding
## [1] "native.enc"
## 
## $example.ask
## [1] "default"
## 
## $expressions
## [1] 5000
## 
## $help.search.types
## [1] "vignette" "demo"     "help"    
## 
## $help.try.all.packages
## [1] FALSE
## 
## $htmltools.preserve.raw
## [1] TRUE
## 
## $internet.info
## [1] 2
## 
## $keep.parse.data
## [1] TRUE
## 
## $keep.parse.data.pkgs
## [1] FALSE
## 
## $keep.source
## [1] FALSE
## 
## $keep.source.pkgs
## [1] FALSE
## 
## $knitr.duplicate.label
## [1] "allow"
## 
## $knitr.in.progress
## [1] TRUE
## 
## $knitr.knit2html.force_v1
## [1] TRUE
## 
## $locatorBell
## [1] TRUE
## 
## $mailer
## [1] "mailto"
## 
## $matprod
## [1] "default"
## 
## $max.contour.segments
## [1] 25000
## 
## $max.print
## [1] 99999
## 
## $menu.graphics
## [1] TRUE
## 
## $na.action
## [1] "na.omit"
## 
## $nwarnings
## [1] 50
## 
## $pager
## [1] "/usr/lib/R/bin/pager"
## 
## $papersize
## [1] "letter"
## 
## $pdfviewer
## [1] "echo"
## 
## $pkgType
## [1] "source"
## 
## $printcmd
## [1] "/usr/bin/lpr"
## 
## $prompt
## [1] "> "
## 
## $repos
##     CRAN 
## "@CRAN@" 
## 
## $rl_word_breaks
## [1] " \t\n\"\\'`><=%;,|&{()}"
## 
## $scipen
## [1] 0
## 
## $show.coef.Pvalues
## [1] TRUE
## 
## $show.error.messages
## [1] TRUE
## 
## $show.signif.stars
## [1] TRUE
## 
## $showErrorCalls
## [1] TRUE
## 
## $showNCalls
## [1] 50
## 
## $showWarnCalls
## [1] FALSE
## 
## $str
## $str$strict.width
## [1] "no"
## 
## $str$digits.d
## [1] 3
## 
## $str$vec.len
## [1] 4
## 
## $str$list.len
## [1] 99
## 
## $str$deparse.lines
## NULL
## 
## $str$drop.deparse.attr
## [1] TRUE
## 
## $str$formatNum
## function (x, ...) 
## format(x, trim = TRUE, drop0trailing = TRUE, ...)
## <environment: 0x55b968c1d570>
## 
## 
## $str.dendrogram.last
## [1] "`"
## 
## $texi2dvi
## [1] "emulation"
## 
## $tikzMetricsDictionary
## [1] "rmdpartials-tikzDictionary"
## 
## $timeout
## [1] 60
## 
## $try.outFile
## A connection with                    
## description ""      
## class       "file"  
## mode        "w+b"   
## text        "binary"
## opened      "opened"
## can read    "yes"   
## can write   "yes"   
## 
## $ts.S.compat
## [1] FALSE
## 
## $ts.eps
## [1] 1e-05
## 
## $unzip
## [1] "/usr/bin/unzip"
## 
## $useFancyQuotes
## [1] FALSE
## 
## $verbose
## [1] FALSE
## 
## $warn
## [1] 1
## 
## $warnPartialMatchArgs
## [1] FALSE
## 
## $warnPartialMatchAttr
## [1] FALSE
## 
## $warnPartialMatchDollar
## [1] FALSE
## 
## $warning.length
## [1] 1000
## 
## $width
## [1] 80