Hello, did you try to replace the print commands with HTML? But first you have to specify a file through HTMLStart and at the end of the function HTMLStop. Including plots is no problem, but you have to save them and then with the HTMLInsertGraph function insert them into your report.
Kind regards Bart Fredrik Karlsson wrote: > > Dear list, > > I am trying to construct a report function that would go through all > the object in the current environment and print them in HTML form. > What I have got is: > > dataReport <- function(){ > > #First tables > tabs <- ls(sys.frame(), pattern=".*table") > > for(currT in tabs){ > cat("\n\n") > print(currT) > if(length(dim(get(currT))) > 2){ > #We have to use ftable > require(Hmisc) > print(ftable(get(currT))) > } > else{ > print(get(currT)) > print(chisq.test(get(currT))) > } > > } > > #Next, the lme models > mods <- ls(sys.frame(), pattern=".*lme") > require(nlme) > for(currM in mods){ > if(class(get(currM)) %in% c("lme","lm")){ > cat("\n\n") > print(currM) > > print(anova(get(currM))) > } > > } > > } > > This generally works in the console. However, it I try to get the > output processed by R2HTML, I get only the output of one table. > So, now I have 2 questions: > > 1) Is there a way to get the output of all the print commands of the > function to be processed by R2HTML? > 2) Is there a way to include saved plots in the output too? > > > /Fredrik > > > -- > "Life is like a trumpet - if you don't put anything into it, you don't > get anything out of it." > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > -- View this message in context: http://www.nabble.com/R2HTML-and-output-from-a-function-tp21070859p21072921.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.