ReporingTools and knitr

Introduction

It is possible to include ReportingTools elements into knitr R markdown documents. Compiling such documents must be done with knitr::knit2html (instead of rmarkdown::render).

A table

The following code chunk, with argument results='asis' will produce the dynamic table below. Note that we need to specify the final vignette destination directory (instDoc) for the JavaScript code to be effectively inserted in the vignette. If it were not for a vignette, the reportDirectory would be the directory containing the report file.

library("rauthoring")
data(res)
## must not be an instance of class DESeqResults
res <- data.frame(res[1:100, ])
library("ReportingTools")
library("XML")
instDoc <- file.path("..", "inst", "doc")
htmlRep <- HTMLReport(shortName = "knitrReport",
                      handlers = knitrHandlers,
                      reportDirectory = instDoc)
htmlRep[["res"]] <- res

baseMeanlog2FoldChangelfcSEstatpvaluepadj
baseMeanlog2FoldChangelfcSEstatpvaluepadj
614-0.01720.0867-0.1990.8430.976
0.55-0.1031.09-0.09460.925 
304-0.01690.0952-0.1780.8590.98
184-0.09650.121-0.7950.4260.889
2070.350.1442.430.01490.273
11.2-0.06360.449-0.1420.887 
17.9-0.5120.353-1.450.147 
12700.08480.08061.050.2930.82
3120.03980.1020.3890.6970.951
399-0.0560.0971-0.5770.5640.931
137-0.09790.136-0.7170.473 
924-0.1770.0797-2.220.02620.357
3850.05460.09180.5950.5520.929
485-0.0480.0935-0.5130.6080.937
97.10.0670.1970.3410.733 
11.40.1650.5030.3290.742 
1250-0.06230.0627-0.9950.320.837
4640.070.09680.7230.4690.907
4960.02440.08290.2940.7690.961
86.1-0.1920.167-1.150.251 
1.48-0.4870.976-0.4990.618 
64.30.1170.1960.5950.552 
755-0.08020.0788-1.020.3090.828
5710.05930.08320.7130.4760.909
17.30.08770.3470.2530.801 
0.2820.21.050.1910.849 
0.150.370.8720.4240.671 
0.3090.07161.030.06920.945 
170-0.001930.138-0.0140.9890.998
1970-0.03310.066-0.5010.6170.94
2660.02810.1040.2690.7880.965
57.7-0.1920.204-0.940.347 
9960.007720.06780.1140.9090.985
39-0.02110.249-0.08480.932 
714-0.280.244-1.150.2510.792
2680.2580.1052.470.01350.26
4520.05030.09510.5290.5970.936
494-0.06810.0834-0.8170.4140.881
1480.0880.1380.640.5220.923
813-0.2310.0812-2.850.004360.135
494-0.1390.125-1.110.2670.803
108-0.2380.156-1.530.127 
544-0.09330.0809-1.150.2490.792
97.5-0.2020.175-1.150.249 
64500.02930.07330.3990.690.951
7570.07720.07081.090.2760.809
64.10.1560.210.7450.456 
11000.06120.06330.9660.3340.844
5420.0450.09660.4650.6420.945
834-0.02920.0692-0.4220.6730.947
0.716-0.4611.1-0.4210.674 
1550-0.03850.0621-0.620.5350.924
971-0.08260.0702-1.180.2390.789
10500.0120.06950.1720.8630.981
84.60.02750.1690.1620.871 
300-0.1160.106-1.090.2740.808
2920.001560.10.01550.9880.998
4.8-0.3160.682-0.4630.643 
1220.2610.1471.780.0746 
396-0.01170.0905-0.130.8970.985
70.70.04390.1830.2390.811 
6.45-0.5810.698-0.8340.405 
43.6-0.03970.238-0.1670.868 
0     
0.2610.4441.030.4310.666 
397-0.06990.087-0.8030.4220.886
1930.08610.1240.6940.4880.913
703-0.110.0718-1.530.1270.663
0.130.860.8640.9960.319 
0.4370.4211.080.3910.696 
418-0.01950.0892-0.2190.8270.972
5610.1210.08331.460.1450.692
4080.03340.09430.3540.7230.957
27200.02270.06510.3490.7270.957
392-0.0550.091-0.6050.5450.929
20800.07420.06321.170.2410.79
82.4-0.4180.175-2.40.0166 
0.6710.4281.090.3910.695 
171-0.07930.128-0.620.5350.924
3270.06490.1010.6460.5180.921
10.40.1340.5270.2540.799 
1020-0.3190.104-3.060.002240.0904
324-0.02440.0993-0.2450.8060.967
354-0.03040.0913-0.3330.7390.959
32.20.4320.311.390.164 
2310.6990.3142.220.02610.357
466-0.009540.0838-0.1140.9090.985
8060.1020.07811.310.1910.751
3830.06510.09860.6610.5090.918
90.10.260.171.530.126 
3190.05210.1270.4110.6810.95
281-0.04280.102-0.4210.6740.947
12700.000540.07890.006850.9951
4420.2540.084830.002740.102
0     
0.1840.4990.9130.5460.585 
204-0.05510.113-0.4880.6250.941
1840.1470.1331.10.2720.806
850-0.140.0814-1.720.08460.584
2.730.1390.7590.1830.855 
baseMeanlog2FoldChangelfcSEstatpvaluepadj

See also ReporterTools's knitr vignette.