Reputation: 327
I am getting error messages when trying to create a scatterplot in R. My professor does not get this error message when using the same dataset and the same code. I re-installed R, RStudio, and all R packages without success. The plot looks fine, so I don't understand why it throws these errors.
As I am using RMarkdown (not in this particular code snippet, but I want to include this plot in a RMarkdown file), the error messages appear in the RMarkdown output along with the graph and I would like to remove these error messages from the output so that it looks clean.
The dataset was taken from https://wps.pearsoned.co.uk/wps/media/objects/12401/12699039/datasets3e/datasets/caschool.xlsx.
I would appreciate any hints to either (1) suppress the warning messages as the plot actually looks fine (2) or to solve the underlying problem. Option (2) would be preferable, of course.
library(readxl)
caschool <- read_excel("../dataStockWatson15/caschool.xlsx")
library(car)
scatterplot(testscr~str, reg.line=FALSE, smooth=FALSE, spread=FALSE, boxplots=FALSE, span=0.5, ellipse=FALSE, levels=c(.5, .9), data=caschool)
warnings()
Warnings:
Warning messages:
1: In plot.window(...) : "reg.line" is not a graphical parameter
2: In plot.window(...) : "spread" is not a graphical parameter
3: In plot.window(...) : "span" is not a graphical parameter
4: In plot.window(...) : "levels" is not a graphical parameter
5: In plot.xy(xy, type, ...) : "reg.line" is not a graphical parameter
6: In plot.xy(xy, type, ...) : "spread" is not a graphical parameter
7: In plot.xy(xy, type, ...) : "span" is not a graphical parameter
8: In plot.xy(xy, type, ...) : "levels" is not a graphical parameter
9: In axis(side = side, at = at, labels = labels, ...) :
"reg.line" is not a graphical parameter
10: In axis(side = side, at = at, labels = labels, ...) :
"spread" is not a graphical parameter
11: In axis(side = side, at = at, labels = labels, ...) :
"span" is not a graphical parameter
12: In axis(side = side, at = at, labels = labels, ...) :
"levels" is not a graphical parameter
13: In axis(side = side, at = at, labels = labels, ...) :
"reg.line" is not a graphical parameter
14: In axis(side = side, at = at, labels = labels, ...) :
"spread" is not a graphical parameter
15: In axis(side = side, at = at, labels = labels, ...) :
"span" is not a graphical parameter
16: In axis(side = side, at = at, labels = labels, ...) :
"levels" is not a graphical parameter
17: In box(...) : "reg.line" is not a graphical parameter
18: In box(...) : "spread" is not a graphical parameter
19: In box(...) : "span" is not a graphical parameter
20: In box(...) : "levels" is not a graphical parameter
21: In title(...) : "reg.line" is not a graphical parameter
22: In title(...) : "spread" is not a graphical parameter
23: In title(...) : "span" is not a graphical parameter
24: In title(...) : "levels" is not a graphical parameter
There were 48 warnings (use warnings() to see them)
Upvotes: 6
Views: 17417
Reputation: 188
The warnings appear to be created in the latest version of the car package which, I presume, you are running. At least, after having updated the package from version 2.1.6 to version 3.0.0, and having added the packages openxlsx_4.0.17 and rio_0.5.10, I can replicate the warnings.
Short of simply ignoring the warnings, the solution for you hence appears to be the installation of car package version 2.1.6. You can download the source code here: https://cran.r-project.org/src/contrib/Archive/car/.
For a description of how to compile a local package and then load it, see for instance this description: http://cmdlinetips.com/2012/05/how-to-install-a-r-package-locally-and-load-it-easily/
Upvotes: 3