I want to include a plot into some MS Word document using the reporteRs
library.
Here is how I include my plot :
doc = addPlot(doc,
fun = function() plot(
km.as.one,
mark.time=TRUE,
conf.int=FALSE,
cex=1,
col="blue",
xlab = "Délai en années", ylab = "Pourcentage",
lty=1:3,
),
vector.graphic = TRUE, width = 5, height = 4,
par.properties = parProperties(text.align = "center")
)
My problem is that I would like to add some error bars, customize the axis and maybe add the title, by adding something like following :
axis(1, at = seq(0, 36, by = 6))
with (data=summary.km.as.one, expr=errbar(time, surv, upper, lower, add=TRUE, pch=0.5, cap=0.02))
I have to write this outside of the plot
statement, but I couldn't find how to write it in the anonymous function.
Is it even possible to write several statements in an anonymous function ?
If yes, what is the right way, and if not, is there any workaround ?
Just add braces { }
and you can add multiple lines:
doc = addPlot(doc,
fun = function() {
# line 1
# line 2
# etc...
},
vector.graphic = TRUE, width = 5, height = 4,
par.properties = parProperties(text.align = "center")
)