'Error in plot.new() : internal read error in PDF_endpage

I'm trying to plot a correlation matrix of my data.

Here's my code:

data <- read.table("path/to/data", header=T, sep='\t')
cor <- cor(data)
corrplot(cor, method="color", type="upper")

And i'm getting this error:

Error in plot.new() : internal read error in PDF_endpage

I've never seen this error before and there isn't much on google. Any help?



Solution 1:[1]

I had this error just after cleaning up some temp files and solved it by updating my packages:

update.packages()

To me it happened after I removed some temp R files. Not sure why does pdf() files live in temp folders, though.

Solution 2:[2]

I had this issue and was finally able to resolve it by using graphics.off(). I had to run the command twice but then plotting worked again.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 KenHBS
Solution 2 KNN