user3036922
user3036922

Reputation: 71

R: Error in device(...) : cannot open file

I have been using the package Muma for OPLS regression. Everything works fine except for this part of the code: plsda(scaling="pareto")

I get an error message:

Error in device(...) : 
  cannot open file 'C:/Users/Julia /PLS-DA_pareto/W*cPlot_PLSDA_1Component_pareto.pdf'  

Could you please help fix the problem?

Upvotes: 2

Views: 6324

Answers (3)

user21044049
user21044049

Reputation: 11

Sounds very stupid, but just three-double check that this directory is spelled right and exists. Took my about 30 min to find an extra s somewhere :)

Upvotes: 1

garcesj
garcesj

Reputation: 589

Maybe is simpler... re-run setwd()to the directory where you're working. For me it was the solution.

Upvotes: 0

Boogi
Boogi

Reputation: 153

If you are on Windows, make sure the pdf you want to write to is not open somewhere. A google search yielded: http://r.789695.n4.nabble.com/pdf-creation-error-td870753.html. If the pdf file of the same name I want to run is open when I run

pdf(paste('visual_check.pdf',sep = ''), height = 4, width = 15)

It gives:

Error in pdf(paste("visual_check.pdf", sep = ""), height = 4, width = 15) : cannot open file 'visual_check.pdf'

If the pdf file is not open, it works just fine.

On my old Mac (OS 10.10) this is not an issue and the pdf device will open and the pdf will updated in preview, even if it is open.

Upvotes: 1

Related Questions