# some dummy codelibrary(ggplot)data <- read.table('/Users/mydata',header=TRUE)model <- lm(Y~X*Y,data)# write this result to HTML:summary(model)解决方法 我想我不明白你到底缺少什么,但这里有一个我做过的最小例子.要运行它
library(knitr)knit("r-report.HTML")
而这个例子.@H_403_11@
<HTML><head> <Title>Analyzing Diamonds!</Title></head><BODY><H1>Diamonds are everywhere!</H1><!--begin.rcode echo=FALSE## Load librarIEs,but do not show thislibrary(ggplot2)library(plyr)testData <- rnorm(1)end.rcode-->This is an analysis of diamonds,load the data.<p><!--begin.rcode echo=TRUE,fig.keep="all"# Load the datadata(diamonds)# PrevIEwhead(diamonds)end.rcode-->Generate a figure,don't show code <p><!--begin.rcode echo=FALSE,fig.align="center",dev="png"# This code is not shown,but figure will outputqplot(diamonds$color,fill=diamonds$color) + opts(title="A plot Title")end.rcode-->Show some code,don't output the figure<p><!--begin.rcode echo=TRUE,fig.keep="none"# Show the code for this one,but don't write out the figureggplot(diamonds,aes(carat,price,colour=cut)) + geom_point(aes(Alpha=0.9))end.rcode-->And the value testData: <!--rinline testData --> insIDe a text block.</BODY></HTML>总结
以上是内存溢出为你收集整理的使用knitr从R中编写html全部内容,希望文章能够帮你解决使用knitr从R中编写html所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)