Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Possibly) Incompatible code in Lesson 27 #18

Open
khangquangtran opened this issue Sep 19, 2022 · 1 comment
Open

(Possibly) Incompatible code in Lesson 27 #18

khangquangtran opened this issue Sep 19, 2022 · 1 comment

Comments

@khangquangtran
Copy link

The first two code lines in Lesson 27:

plot(mlb$Age,mlb$Weight,col=mlb$PosCategory)

and

with(mlb,plot(Age,Weight,col=PosCategory,cex=0.6))

are not compatible with current version of R (4.2.1).

The error when using these two lines:

Error in plot.xy(xy, type, ...) : invalid color name 'Catcher'

Suggested fixes based on Stack Overflow
(link: https://stackoverflow.com/questions/66854539/r-does-not-assign-colors-to-plot-function):

plot(mlb$Age,mlb$Weight,col=as.factor(mlb$PosCategory))

and

with(mlb,plot(Age,Weight,col=as.factor(PosCategory),cex=0.6))

However, I am not sure if these suggested fixes are compatible with earlier versions of R.

@matloff
Copy link
Owner

matloff commented Sep 21, 2022

Thanks. Was not a version issue. Anyway, I rewrote Lessons 29 and 30 completely. Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants