Add R highlighting from RStudio (plus other dependencies)

This commit is contained in:
Garen Torikian 2012-11-11 21:17:42 -08:00 • committed by JJ Allaire
commit af70013668
14 changed files with 865 additions and 0 deletions

View file

@ -0,0 +1,20 @@
Call:
lm(formula = y ~ x)
Residuals:
1 2 3 4 5 6
3.3333 -0.6667 -2.6667 -2.6667 -0.6667 3.3333
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -9.3333 2.8441 -3.282 0.030453 *
x 7.0000 0.7303 9.585 0.000662 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 3.055 on 4 degrees of freedom
Multiple R-squared: 0.9583, Adjusted R-squared: 0.9478
F-statistic: 91.88 on 1 and 4 DF, p-value: 0.000662
> par(mfrow=c(2, 2)) # Request 2x2 plot layout
> plot(lm_1) # Diagnostic plot of regression model

View file

@ -0,0 +1,64 @@
\name{picker}
\alias{picker}
\title{Create a picker control}
\description{
Create a picker control to enable manipulation of plot variables based on a set of fixed choices.
}
\usage{
picker(..., initial = NULL, label = NULL)
}
\arguments{
\item{\dots}{
Arguments containing objects to be presented as choices for the picker (or a list containing the choices). If an element is named then the name is used to display it within the picker. If an element is not named then it is displayed within the picker using \code{\link{as.character}}.
}
\item{initial}{
Initial value for picker. Value must be present in the list of choices specified. If not specified defaults to the first choice.
}
\item{label}{
Display label for picker. Defaults to the variable name if not specified.
}
}
\value{
An object of class "manipulator.picker" which can be passed to the \code{\link{manipulate}} function.
}
\seealso{
\code{\link{manipulate}}, \code{\link{slider}}, \code{\link{checkbox}}, \code{\link{button}}
}
\examples{
\dontrun{
## Filtering data with a picker
manipulate(
barplot(as.matrix(longley[,factor]),
beside = TRUE, main = factor),
factor = picker("GNP", "Unemployed", "Employed"))
## Create a picker with labels
manipulate(
plot(pressure, type = type),
type = picker("points" = "p", "line" = "l", "step" = "s"))
## Picker with groups
manipulate(
barplot(as.matrix(mtcars[group,"mpg"]), beside=TRUE),
group = picker("Group 1" = 1:11,
"Group 2" = 12:22,
"Group 3" = 23:32))
## Histogram w/ picker to select type
require(lattice)
require(stats)
manipulate(
histogram(~ height | voice.part,
data = singer, type = type),
type = picker("percent", "count", "density"))
}
}

View file

@ -0,0 +1,22 @@
<html>
<head>
<title>Title</title>
</head>
<body>
<p>This is an R HTML document. When you click the <b>Knit HTML</b> button a web page will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:</p>
<!--begin.rcode
summary(cars)
end.rcode-->
<p>You can also embed plots, for example:</p>
<!--begin.rcode fig.width=7, fig.height=6
plot(cars)
end.rcode-->
</body>
</html>

View file

@ -0,0 +1,20 @@
The quadratic formula is $$-b \pm \sqrt{b^2 - 4ac} \over 2a$$
\bye
\makeatletter
\newcommand{\be}{%
\begingroup
% \setlength{\arraycolsep}{2pt}
\eqnarray%
\@ifstar{\nonumber}{}%
}
\newcommand{\ee}{\endeqnarray\endgroup}
\makeatother
\begin{equation}
x=\left\{ \begin{array}{cl}
0 & \textrm{if }A=\ldots\\
1 & \textrm{if }B=\ldots\\
x & \textrm{this runs with as much text as you like, but without an raggeright text
.}\end{array}\right.
\end{equation}