R error saving ggplot pdf -


when try save plot made using ggplot pdf using code:

library(ggplot2)  file = "/data/mda/20150630-1mb-full_comparison-low_depth_htert/result/comparison_figure/sd_rank_custom.csv" figure_file = "/data/mda/20150604-1mb-full_comparison-low_depth_htert/result/comparison_figure/sd_rank_custom.pdf"  sd_data <- as.data.frame(read.csv(file, header=true))  # generate box plot ggplot(     data=sd_data,     aes(         x=experiment,          y=sd     ) )+   theme_bw() + #use bw theme geom_boxplot(outlier.shape = na) + #hide outlier points geom_jitter() +  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))     ggsave(   filename=figure_file,   width=10,   height=10 ) 

i following error:

error in grdevices::pdf(..., version = version) :

cannot open file 'file.pdf'

calls: ggsave -> device ->

execution halted

i think version of r updated 3.2.0, , i've confirmed works fine in v3.1.1 i'm assuming version related. confirmed can write csv file directory.

any ideas how fix this?

i think you're trying write non-existent folder, , far know grdevices won't allow this. someone else seems have similar issue.

i tried code both in r 3.1.1 , 3.2.1—they both give same error (unless directory created on beforehand.

you try adding following line of code:

dir.create(file.path(dirname(figure_file))) 

it create directory you.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -