Created
February 7, 2013 12:01
-
-
Save nassimhaddad/4730506 to your computer and use it in GitHub Desktop.
generate html code with R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(R2HTML) | |
# setup a temporaty file to store the code | |
fileName <- 'temp.html' | |
.HTML.file = file.path(getwd(), fileName) | |
# make a title | |
HTML(as.title("Title of my report"), append = FALSE) | |
# add space | |
HTMLhr() | |
# add text | |
HTML("3 dimensions identity matrix") | |
# add a matrix | |
HTML(diag(3)) | |
# add a matrix with internal border formatting | |
# note: more info about formatting: ?HTML.data.frame | |
HTML(diag(3), innerBorder = 1) | |
# get the html code into a variable | |
hrml_code_chunk <- readChar(fileName, file.info(fileName)$size) | |
# clean up | |
file.remove(fileName) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment