I have the following R code in Lyx + Knitr. I would like to have R run and create an external correlation HTML file. The code is running successfully, however, the actual HTML contents are being displayed inside my Knitr PDF document that is generated. Is it possible to move this out into the other file? I can run the exact same code straight in R and it works fine.
<<Correlation_Table, echo=FALSE, message=FALSE>>=
sink("correlation_table.html", append=FALSE, split=FALSE)
library("xtable")
library("Hmisc")
corstarsl <- function(x){
#create table code here...
}
sprintf("correlation table:")
print(xtable(corstarsl(data[,c(19:22)])), type="html")
sprintf("<p>p < .001 = ***</p><p>p < .01 = **</p><p>p < .05 = *</p>")
#finish output to file
sink()
@
Thanks.