[R] knitr without R studio

Ista Zahn istazahn at gmail.com
Wed Jun 19 13:42:37 CEST 2013


Hi Alex,

Have you read the ?knit or ?knit2html documentation? I don't believe
there is a kit2HTML function (notice the uppercase), and the input
should be the path to a file. Please do read the documentation.

Best,
Ista

On Wed, Jun 19, 2013 at 3:53 AM, AlexPiche
<alexandre.piche at mail.mcgill.ca> wrote:
> Hello folks,
>
> I`m using knitr on R studio, which make it easy to use, but a coworker of
> mine would like to run it on "simple" R. So I was wondering if you know what
> is the equivalent of  the button "knit HTML" in RStudio in R. I tried
>
>
> knit2HTML(
>
> <html>
> <head>
>   <title></title>
> </head>
> <body style="background-color:white">
>
>
>
>
>   <p style="font-size:16px; text-align:center">
> Graph 1 <#location1>      Graph 2 <#location2>
>   </p>
>
> ```{r table1, comment=NA, results='asis'}
> library(xtable)
> data(iris)
> print(xtable(head(iris, 10)), type = "html", include.rownames = T)
> ```
>
>
>
> ```{r, include=FALSE}
>
>
> opts_knit$set(progress = TRUE, verbose = TRUE)
> opts_chunk$set(fig.width=20, fig.height=12)
> knit_hooks$set(fig.bg = function(before, options, envir) {
>   if (before) par(bg = options$fig.bg)
> })
>
> ```
>
>
>
>
>
>
> ```{r graphs,fig.keep=’last’}
> for (x in 1:10) plot(rnorm(100), col = x)
> ```
>
>
>
>
> ```{r graph1}
>
> plot(rnorm(500), type="lines", main="Graph1")
> ```
>   Top of the Page <#top>
>
>
>
>
>
> ```{r graph2}
>
>
> plot(rpois(500,3), type="lines", main="Graph2")
>
> ```
>
> Top of the Page <#top>
>
>
>
>
>
> </body>
> </html>
> )
>
>
> But R keep sending me error message, any clue?
>
> Regards,
>
> Alex
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/knitr-without-R-studio-tp4669841.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list