-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't add ggsurvplot to powerpoint document using ReporteRs if there is no risk table #314
Comments
Fixed now, thanks. The following R code works: library(survminer)
library(survival)
fit<- survfit(Surv(time, status) ~ sex, data = lung)
ggsurv <- ggsurvplot(fit , ggtheme = theme_bw())
library('ReporteRs')
# Create a new powerpoint document
doc <- pptx()
# Add a new slide into the ppt document
doc <- addSlide(doc, slide.layout = "Two Content" )
# Add a slide title
doc <- addTitle(doc, "Survival Curves" )
# Print the survival curves in the powerpoint
doc <- addPlot(doc, function() print(ggsurv, newpage = FALSE),
vector.graphic = TRUE # Make it editable
)
# write the document to a file
writeDoc(doc, file = "survival-curves.pptx") |
were there some changes on this lately?
Any Ideas?
Matrix products: default locale: attached base packages: other attached packages: loaded via a namespace (and not attached): |
The code still work for me. Make sure to specify the argument |
ReporteRs was rewrited to officer package, ggsurvplot object of class "c('ggsurvplot', 'ggsurv', 'list') still can not export to pptx file in officer package. Need to be solved!!! Thank you! |
And the ReporteRs package is now not avalible for 3.6.0 version R. |
Expected behavior
Plot should be added to slide with no error.
Actual behavior
Plot is not added and get the error, "Error in grid.newpage() : pptx device only supports one page". Note, if risk.table = TRUE in the ggsurvplot object, there is no error and the expected behavior occurs.
Steps to reproduce the problem
Create a ggsurvplot object with the risk.table argument set to FALSE and store in variable x. Using the ReporteRs package, create a new slide in a powerpoint document and use the addPlot function to add x to the slide by setting the "fun" argument to function (x) {print(x, newpage = FALSE)}
session_info()
Session info ----------------------------------------------------------------------------------------------------------------------------
setting value
version R version 3.5.0 (2018-04-23)
system x86_64, mingw32
ui Rgui
language (EN)
collate English_Canada.1252
tz America/New_York
date 2018-06-19
Packages --------------------------------------------------------------------------------------------------------------------------------
package * version date source
assertthat 0.2.0 2017-04-11 CRAN (R 3.5.0)
base * 3.5.0 2018-04-23 local
base64enc 0.1-3 2015-07-28 CRAN (R 3.5.0)
bindr 0.1.1 2018-03-13 CRAN (R 3.5.0)
bindrcpp * 0.2.2 2018-03-29 CRAN (R 3.5.0)
broom 0.4.4 2018-03-29 CRAN (R 3.5.0)
cmprsk 2.2-7 2014-06-17 CRAN (R 3.5.0)
colorspace 1.3-2 2016-12-14 CRAN (R 3.5.0)
compiler 3.5.0 2018-04-23 local
data.table 1.11.4 2018-05-27 CRAN (R 3.5.0)
datasets * 3.5.0 2018-04-23 local
devtools 1.13.5 2018-02-18 CRAN (R 3.5.0)
digest 0.6.15 2018-01-28 CRAN (R 3.5.0)
dplyr 0.7.5 2018-05-19 CRAN (R 3.5.0)
foreign 0.8-70 2017-11-28 CRAN (R 3.5.0)
gdtools * 0.1.7 2018-02-27 CRAN (R 3.5.0)
ggplot2 * 2.2.1 2016-12-30 CRAN (R 3.5.0)
ggpubr * 0.1.6 2017-11-14 CRAN (R 3.5.0)
glue 1.2.0 2017-10-29 CRAN (R 3.5.0)
graphics * 3.5.0 2018-04-23 local
grDevices * 3.5.0 2018-04-23 local
grid 3.5.0 2018-04-23 local
gridExtra 2.3 2017-09-09 CRAN (R 3.5.0)
gtable 0.2.0 2016-02-26 CRAN (R 3.5.0)
htmltools 0.3.6 2017-04-28 CRAN (R 3.5.0)
httpuv 1.4.3 2018-05-10 CRAN (R 3.5.0)
km.ci 0.5-2 2009-08-30 CRAN (R 3.5.0)
KMsurv 0.1-5 2012-12-03 CRAN (R 3.5.0)
knitr 1.20 2018-02-20 CRAN (R 3.5.0)
labeling 0.3 2014-08-23 CRAN (R 3.5.0)
later 0.7.3 2018-06-08 CRAN (R 3.5.0)
lattice 0.20-35 2017-03-25 CRAN (R 3.5.0)
lazyeval 0.2.1 2017-10-29 CRAN (R 3.5.0)
magrittr * 1.5 2014-11-22 CRAN (R 3.5.0)
Matrix 1.2-14 2018-04-13 CRAN (R 3.5.0)
memoise 1.1.0 2017-04-21 CRAN (R 3.5.0)
methods * 3.5.0 2018-04-23 local
mime 0.5 2016-07-07 CRAN (R 3.5.0)
mnormt 1.5-5 2016-10-15 CRAN (R 3.5.0)
munsell 0.5.0 2018-06-12 CRAN (R 3.5.0)
nlme 3.1-137 2018-04-07 CRAN (R 3.5.0)
officer 0.3.1 2018-06-12 CRAN (R 3.5.0)
parallel 3.5.0 2018-04-23 local
pillar 1.2.3 2018-05-25 CRAN (R 3.5.0)
pkgconfig 2.0.1 2017-03-21 CRAN (R 3.5.0)
plyr 1.8.4 2016-06-08 CRAN (R 3.5.0)
png 0.1-7 2013-12-03 CRAN (R 3.5.0)
promises 1.0.1 2018-04-13 CRAN (R 3.5.0)
psych 1.8.4 2018-05-06 CRAN (R 3.5.0)
purrr 0.2.5 2018-05-29 CRAN (R 3.5.0)
R.methodsS3 1.7.1 2016-02-16 CRAN (R 3.5.0)
R.oo 1.22.0 2018-04-22 CRAN (R 3.5.0)
R.utils 2.6.0 2017-11-05 CRAN (R 3.5.0)
R6 2.2.2 2017-06-17 CRAN (R 3.5.0)
Rcpp 0.12.17 2018-05-18 CRAN (R 3.5.0)
ReporteRs * 0.8.10 2018-03-28 CRAN (R 3.5.0)
ReporteRsjars * 0.0.4 2018-03-28 CRAN (R 3.5.0)
reshape2 1.4.3 2017-12-11 CRAN (R 3.5.0)
rJava 0.9-10 2018-05-29 CRAN (R 3.5.0)
rlang 0.2.1 2018-05-30 CRAN (R 3.5.0)
rvg 0.1.9 2018-06-10 CRAN (R 3.5.0)
scales 0.5.0 2017-08-24 CRAN (R 3.5.0)
shiny 1.1.0 2018-05-17 CRAN (R 3.5.0)
splines 3.5.0 2018-04-23 local
stats * 3.5.0 2018-04-23 local
stringi 1.1.7 2018-03-12 CRAN (R 3.5.0)
stringr 1.3.1 2018-05-10 CRAN (R 3.5.0)
survival * 2.41-3 2017-04-04 CRAN (R 3.5.0)
survminer * 0.4.2 2018-01-31 CRAN (R 3.5.0)
survMisc 0.5.4 2016-11-23 CRAN (R 3.5.0)
tibble 1.4.2 2018-01-22 CRAN (R 3.5.0)
tidyr 0.8.1 2018-05-18 CRAN (R 3.5.0)
tidyselect 0.2.4 2018-02-26 CRAN (R 3.5.0)
tools 3.5.0 2018-04-23 local
utils * 3.5.0 2018-04-23 local
uuid 0.1-2 2015-07-28 CRAN (R 3.5.0)
withr 2.1.2 2018-03-15 CRAN (R 3.5.0)
xml2 1.2.0 2018-01-24 CRAN (R 3.5.0)
xtable 1.8-2 2016-02-05 CRAN (R 3.5.0)
zip 1.0.0 2017-04-25 CRAN (R 3.5.0)
zoo 1.8-2 2018-06-11 CRAN (R 3.5.0)
The text was updated successfully, but these errors were encountered: