R FAQ
How can I view my R code and output in html?
The R2HTML package allows R users to create .html files containing their R code and output. The .html file created can be easily navigated and offer an alternative to scrolling through an Rgui window. This page provides a basic example. More of the available options can be found in the R2HTML documentation.
We will first load the packages and needed. We will use an online Stata dataset, so we will use the foreign package to read it in, and we will also need R2HTML.
library(R2HTML) library(lme4) library(foreign) hsb2<-read.dta("https://stats.idre.ucla.edu/stat/stata/notes/hsb2.dta", convert.factors = FALSE)
To generate a .html file of our subsequent R commands and their output,