| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/utils-conversion.R |
| 3 |
\name{knit_watch} |
| 4 |
\alias{knit_watch} |
| 5 |
\title{Watch an input file continuously and knit it when it is updated} |
| 6 |
\usage{ |
| 7 |
knit_watch(input, compile = knit, interval = 1, ...) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{input}{An input file path, or a character vector of mutiple input file paths.} |
| 11 |
|
| 12 |
\item{compile}{A function to compile the \code{input} file. This could be e.g. |
| 13 |
\code{\link{knit}} or \code{\link{knit2pdf}}, depending on the input file |
| 14 |
and the output you want.} |
| 15 |
|
| 16 |
\item{interval}{A time interval to pause in each cycle of the infinite loop.} |
| 17 |
|
| 18 |
\item{...}{Other arguments to be passed to the \code{compile} function.} |
| 19 |
} |
| 20 |
\description{ |
| 21 |
Check the modification time of an input file continously in an infinite loop. |
| 22 |
Whenever the time indicates the file has been modified, call a function to |
| 23 |
recompile the input file. |
| 24 |
} |
| 25 |
\details{ |
| 26 |
This is actually a general function not necessarily restricted to |
| 27 |
applications in \pkg{knitr}. You may specify any \code{compile} function to |
| 28 |
process the \code{input} file. To stop the infinite loop, press the |
| 29 |
\samp{Escape} key or \samp{Ctrl + C} (depending on your editing environment |
| 30 |
and operating system). |
| 31 |
} |
| 32 |
\examples{ |
| 33 |
# knit_watch('foo.Rnw', knit2pdf) |
| 34 |
|
| 35 |
# knit_watch('foo.Rmd', rmarkdown::render) |
| 36 |
} |