2014-03-25 103 views

回答

3

當然

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() 

謝謝,只要給它一個字符串如常。

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 = " ") 
+0

非常感謝答案羅伯特! :) – Ianthe