R is saving empty sheets for several KM plots using RTCGA package
0
0
Entering edit mode
16 months ago

Hi!

I have an issue when I'm trying to save several plots in a pdf file using R. I created these plots using the RTCGA package. The command to generate one plot is the next:

kmTCGA(my_data, ##My data is stored in a list
explanatory.names = "TP53",
pval = T,
conf.int = F,
risk.table = F)


To save multiple plots I'm using the next code:

pdf("../mypath/KMplots.pdf", height = 8, width = 10)
for(i in names(categories)){ ##names of my datasets inside the list
for(j in variables){ ##Names of the genes I'm analyzing
print(kmTCGA(categories[[i]],
explanatory.names = j,
pval = T,
conf.int = F,
risk.table = F))
}
}
dev.off()


However, when I inspect the pdf file the first page is empty or in leaved in blank. Does anyone know how to save my data without this empty page?

The same problem occurs when I generate a pdf file with cutoffs plots from survminer package:

pdf("../my_path/Cutpoints.pdf", height = 8, width = 10)
for(i in data){
for(j in variables){
print(plot(cut_points[[i]], j))
}
}
dev.off()


Rodo

files pdf for R KM RTCGA loops plots • 390 views