gbradburd/conStruct

Error when running conStruct: cannot open file 'test_trace.plots.chain_1.pdf'

Closed this issue · 5 comments

Hello,
I have run several conStruct analyses testing different numbers of iterations but every time my run is complete I get the following error: Error in grDevices::pdf(file = paste0(prefix, "trace.plots.chain", chain.no, :
cannot open file 'test_trace.plots.chain_1.pdf'
and the conStruct run does not automatically run "make.all.the.plots" so I manually tried running it after my conStruct run was complete and I get the same error, that it cannot open the file 'test_trace.plots.chain_1.pdf'.

Any help would be appreciated, and I can provide any information that is needed to clarify or assist.

Thank you!

Seems like you're getting an error somewhere. Can you email me your data as a .Robj or .RData object, as well as the script you're using to run conStruct?

Thank you for your response, Giedon. I emailed you all of the information a few days ago. Let me know if there is anything else I can provide. Thank you for your help!

Hi Valentina,

Sorry for the slow reply - I am currently on parental leave and am not responding frequently to emails. However, I looked through what you sent me and I've found one problem. You are loading R objects and assigning them to new variables like so:

conStruct.results <- load("filepath/conStruct.results.Robj")

When you do this, the variable conStruct.results does not contain the objects contained in the "conStruct.results.Robj" R object. Instead, it's just the character vector "conStruct.results", which is what is invisibly returned by the function load(). [You can read more about the behavior of load by checking out its documentation: help(load)]. So if instead you do (inserting your own filenames as appropriate):

load("filepath/conStruct.results.Robj")
load("filepath/data.block.Robj")
make.all.the.plots(conStruct.results = conStruct.results, data.block = data.block, prefix="test", layer.colors = NULL

that should work without any problems. It runs for me without error and generates all the plots.

I can't diagnose why you're getting that error when you run conStruct because I can't run the script you sent me. If you continue to experience this issue, please send me a minimum reproducible example of the code. This should not have references to your own directory paths (which will not exist on my machine), and should refer only to objects that you can send me as .Robj or .RData objects. In addition, this should not contain any extraneous code - just the minimum needed for me to reproduce your error.

Thanks!

Hi Val,

Glad to hear you got it sorted! I'm going to close the issue but please feel free to reopen if the problem resurfaces.