Running examples in ‘define-Ex.R’ failed
The error most likely occurred in:

> ### Name: define
> ### Title: Define objects per FDA guidance.
> ### Aliases: define define.character
> 
> ### ** Examples
> 
> library(spec)                   # read and write data specifications
> library(latexpdf)               # make dummy logo for pdf
> library(encode)                 # encode factor levels for spec file
> 
> dir <- tempdir()                # a place to experiment
> dir <- gsub('\\\\','/',dir)     # clean up windows path
> outdir <- file.path(dir,'out')  # where to put the define archive
> csv <- file.path(dir,'theoph.csv')    # path to data
> script <- file.path(dir,'theoph.R')   # path to script making data
> spec <- file.path(dir,'theoph.spec')  # path to data specification
> 
> # make dummy logo
> ## Not run: 
> ##D as.pdf('{\\huge \\em Pharma, Inc.}',wide = 50, long = 8,stem = 'logo', dir = dir)
> ## End(Not run)
> # browseURL(system.file(package = 'define', 'logo.pdf')) # cached
> logo <- system.file(package = 'define', 'logo.pdf')     # path to dummy logo
> 
> # make data more interesting
> Theoph$renal <- 0
> 
> # create script
> code <- "write.csv(x = Theoph,file = csv,row.names = FALSE,quote = FALSE)"
> writeLines(code,script)
> 
> # 'run' the script
> eval(parse(text = code))
> 
> # make data specification
> s <- specification(Theoph)
> renalcat <- c(
+  'GFR >= 90 mL/min/1.73m^2',
+  '60 <= GFR < 90 mL/min/1.73m^2',
+  '45 <= GFR < 60 mL/min/1.73m^2',
+  '30 <= GFR < 45 mL/min/1.73m^2',
+  'GFR < 30 mL/min/1.73m^2'
+ )
> codes <- encode(0:4, renalcat)
> codes
[1] "||0|GFR >= 90 mL/min/1.73m^2||1|60 <= GFR < 90 mL/min/1.73m^2||2|45 <= GFR < 60 mL/min/1.73m^2||3|30 <= GFR < 45 mL/min/1.73m^2||4|GFR < 30 mL/min/1.73m^2||"
> s$guide[s$column == 'renal'] <- codes
> 
> write.spec(s,spec)
> 
> file.exists(csv)
[1] TRUE
> file.exists(spec)
[1] TRUE
> define(c(theoph = csv),stem = 'minimal',dir = outdir, clean=FALSE)
exporting /tmp/RtmpQ8aGpq/working_dir/Rtmp_waW9P/theoph.csv to /tmp/RtmpQ8aGpq/working_dir/Rtmp_waW9P/out/./theoph.xpt
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(/tmp/RtmpQ8aGpq/working_dir/Rtmp_waW9P/out/minimal.tex
LaTeX2e <2019-10-01> patch level 1
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/article.cls
Document Class: article 2019/08/27 v1.4j Standard LaTeX document class
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2019/texmf-dist/tex/latex/xcolor/xcolor.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics-cfg/color.cfg)
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics-def/pdftex.def)
(/usr/local/texlive/2019/texmf-dist/tex/latex/colortbl/colortbl.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/tools/array.sty))
(/usr/local/texlive/2019/texmf-dist/tex/latex/xcolor/svgnam.def))
(/usr/local/texlive/2019/texmf-dist/tex/latex/geometry/geometry.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2019/texmf-dist/tex/generic/iftex/ifpdf.sty
(/usr/local/texlive/2019/texmf-dist/tex/generic/iftex/iftex.sty))
(/usr/local/texlive/2019/texmf-dist/tex/generic/iftex/ifvtex.sty)
(/usr/local/texlive/2019/texmf-dist/tex/generic/iftex/ifxetex.sty))
(/usr/local/texlive/2019/texmf-dist/tex/latex/multirow/multirow.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/float/float.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/tools/longtable.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/inputenc.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/fontenc.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/t1enc.def))
(/usr/local/texlive/2019/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/ltxcmds.sty)
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/usr/local/texlive/2019/texmf-dist/tex/generic/iftex/ifluatex.sty))
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/etexcmds.sty))
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty)
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/pdfescape.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/oberdiek/hycolor.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/oberdiek/xcolor-patch.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/oberdiek/hopatch.sty)))
(/usr/local/texlive/2019/texmf-dist/tex/latex/oberdiek/letltxmacro.sty))
(/usr/local/texlive/2019/texmf-dist/tex/latex/oberdiek/auxhook.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/oberdiek/kvoptions.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/intcalc.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/latexconfig/hyperref.cfg)
(/usr/local/texlive/2019/texmf-dist/tex/latex/url/url.sty)
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/bitset.sty
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/bigintcalc.sty))
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/atbegshi.sty))
(/usr/local/texlive/2019/texmf-dist/tex/latex/hyperref/hpdftex.def
(/usr/local/texlive/2019/texmf-dist/tex/latex/oberdiek/atveryend.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/uniquecounter.sty)))
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)))
(/usr/local/texlive/2019/texmf-dist/tex/latex/tocbibind/tocbibind.sty

Package tocbibind Note: Using section or other style headings.

) (/usr/local/texlive/2019/texmf-dist/tex/latex/base/fixltx2e.sty

Package fixltx2e Warning: fixltx2e is not required with releases after 2015
(fixltx2e)                All fixes are now in the LaTeX kernel.
(fixltx2e)                See the latexrelease package for details.

) (/usr/local/texlive/2019/texmf-dist/tex/latex/tabu/tabu.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/varwidth/varwidth.sty))
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/fontenc.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/t1enc.def))
(/usr/local/texlive/2019/texmf-dist/tex/latex/datetime/datetime.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/etoolbox/etoolbox.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/fmtcount/fmtcount.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/ifthen.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/local/texlive/2019/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/local/texlive/2019/texmf-dist/tex/generic/xkeyval/xkvutils.tex)))
(/usr/local/texlive/2019/texmf-dist/tex/latex/fmtcount/fcprefix.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/fmtcount/fcnumparser.sty))
(/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/local/texlive/2019/texmf-dist/tex/latex/datetime/datetime-defaults.sty))
(/usr/local/texlive/2019/texmf-dist/tex/latex/fancyhdr/fancyhdr.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/lastpage/lastpage.sty)
No file minimal.aux.
(/usr/local/texlive/2019/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/local/texlive/2019/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/oberdiek/grfext.sty)
(/usr/local/texlive/2019/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
(/usr/local/texlive/2019/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/local/texlive/2019/texmf-dist/tex/latex/oberdiek/refcount.sty)
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
(/usr/local/texlive/2019/texmf-dist/tex/latex/fmtcount/fc-english.def)
! Missing $ inserted.
<inserted text> 
                $
l.31 ...bf{/tmp/RtmpQ8aGpq/working_dir/Rtmp_waW9P}
                                                  }
? 
! Emergency stop.
<inserted text> 
                $
l.31 ...bf{/tmp/RtmpQ8aGpq/working_dir/Rtmp_waW9P}
                                                  }
!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on /tmp/RtmpQ8aGpq/working_dir/Rtmp_waW9P/out/minimal.log.
Error in as.pdf.document(z, stem = stem, dir = dir, ...) : 
  could not make /tmp/RtmpQ8aGpq/working_dir/Rtmp_waW9P/out/minimal.pdf
Calls: define -> define.character -> as.pdf -> as.pdf.document
Execution halted