[R] knitr without R studio

AlexPiche alexandre.piche at mail.mcgill.ca
Wed Jun 19 09:53:49 CEST 2013


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.



More information about the R-help mailing list