/
reprex.Rd
64 lines (54 loc) · 2.03 KB
/
reprex.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/reprex.R
\name{reprex}
\alias{reprex}
\title{Render a reprex}
\usage{
reprex(x = NULL, infile = NULL, venue = c("gh", "so"), outfile = NULL,
show = TRUE, si = FALSE, upload.fun = knitr::imgur_upload)
}
\arguments{
\item{x}{An expression. If not given, \code{reprex} will look for code in
\code{infile}, if provided, or on the clipboard.}
\item{infile}{Path to \code{.R} file containing reprex code.}
\item{venue}{"gh" for GitHub or "so" for stackoverflow.}
\item{outfile}{Desired stub for output \code{.R}, \code{.md}, and
\code{.html} files for reproducible example. If \code{NULL}, keeps them in
temporary files. At this point, outfiles are deposited in current working
directory, but the goal is to consult options for a place to store all
reprexes.}
\item{show}{Whether to show rendered output in a viewer (RStudio or browser).}
\item{si}{Whether to include the results of
\code{\link[devtools]{session_info}}, if available, or
\code{\link{sessionInfo}} at the end of the reprex.}
\item{upload.fun}{Function that is valid for the \code{upload.fun}
\href{http://yihui.name/knitr/options/}{\code{knitr} option}, for uploading
and linking images stored on the web. Defaults to
\code{\link[knitr]{imgur_upload}}.}
}
\description{
Given some R code on the clipboard, in an expression, or in a file, this
function runs it via \code{\link[rmarkdown]{render}}. The resulting bit of
Markdown is the primary output. It will be ready and waiting on the
clipboard, for pasting into a GitHub issue or to stackoverflow. Optionally,
the R code and Markdown will be left behind in files. An HTML preview will
display in RStudio's Viewer pane, if available, or in the default browser
otherwise.
}
\examples{
\dontrun{
# put some code like this on the clipboard
# (y <- 1:4)
# mean(y)
reprex()
# or provide it as code in brackets:
reprex({y <- 1:4; mean(y)})
# note that you can include newlines in those brackets
# in fact, that is probably a good idea
reprex({
x <- 1:4
y <- 2:5
x + y
})
}
}