将JavaScript添加到R2HTML

时间:2014-03-25 01:26:34

标签: r

我可以将RSS添加到R2HTML吗?

将样本<script>标记添加到下面的R2HTML代码

HTMLheaderText ="Sample Report"
HTMLfile =HTMLInitFile(outdir     = getwd()
               , filename = "sample"
               , extension  = "html"
               , Title      = "R Output"
               , CSSFile    = paste(getwd(), "/html_tables.css", sep="")
               , HTMLframe  = FALSE
               , useGrid    = FALSE
               , useLaTeX   = FALSE)

 HTML(HTMLheaderText, file = HTMLfile)
 HTML(dataSet, row.names = FALSE)
 HTMLEndFile()

提前致谢

1 个答案:

答案 0 :(得分:3)

当然,像往常一样给它一个字符串。

HTML('<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>', file = HTMLfile)

它将被包裹在<p class="character">中。如果您不想要,只需手动附加到文件

cat('<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>', file = HTMLfile, append = TRUE, sep = " ")