How addPlot to bsdoc document in ReporteRs package?

262 views Asked by At

I am trying to add a plot to a bsdoc in ReporteRs package. When I run the example on the tutorial site it only gives back the table. The plot is nowhere to be seen. Is it a bug or am I doing something wrong? I am using a virtual machine and tried different browsers (IE, chrome, Firefox) with no success.

library( ReporteRs )

# Creation of mydoc
mydoc = bsdoc( title = 'my document' )

# add into mydoc first 10 lines of iris
mydoc = addFlexTable( mydoc, vanilla.table(iris[1:10,] ) )

mydoc = addParagraph( mydoc, value = "Hello World!" )

# add a plot into mydoc 
mydoc = addPlot( mydoc, function() barplot( 1:8, col = 1:8 ) )

# write the doc 
writeDoc( mydoc, file = "examples/htmloutput/bsdoc_simple_example.html" )

EDIT The tutorial says "Note that other files will be copied in the directory containing the html file (i.e. the bootstrap css, js directories)." In my case that does not happen. So mayby that's the cause of my problem. Still I have no clue how to solve that.

EDIT2 The html output contains a link that says 'Skip to main content'. Isn't that a bit strange as well?

1

There are 1 answers

0
The6thSense On BEST ANSWER

The answer to this problem is the folder should not be already created .It should be created by the module.

I ran the above method using both by creating the folder and not creating it

The js,css and other files are only created when the folder is not available

The function needs to create a folder not necessarily examples/htmloutput/

i.e.

writeDoc( mydoc, file = "outputs/bsdoc_simple_example.html" )

Will create a folder if it not available and create all needed files in the folder BUT if the is available then it will only create the HTML file