attach(auto)
The following object is masked _by_ .GlobalEnv:
cylinders
The following objects are masked from auto (pos = 3):
acceleration, cylinders, displacement, horsepower, mpg, name, origin,
weight, year
plot(cylinders, mpg)
>Error in stats::model.frame.default(formula = y ~ x) :
variable lengths differ (found for 'x')
Asked
Active
Viewed 158 times
0

zx8754
- 52,746
- 12
- 114
- 209

Rohitashva Raj
- 1
- 2
-
Could you add where `auto` is from and/or add a sample of it with `dput`? – NelsonGon Jul 07 '20 at 11:48
-
Does this answer your question? [Error in model.frame.default: variable lengths differ](https://stackoverflow.com/questions/19771284/error-in-model-frame-default-variable-lengths-differ) – NelsonGon Jul 07 '20 at 11:49
-
Also when i use plot(cylinders) , plot(mpg) separately, it is working – Rohitashva Raj Jul 07 '20 at 12:01
-
"Auto" is a data file that i took from ISL book's website. I had used the same commands before, it was working fine. Then my Rstudio got stuck. So i saved, closed my Rstudio and started working again from where i had left. Now i am getting these errors that i had mentioned – Rohitashva Raj Jul 07 '20 at 12:05
-
Okay i used rm(list=ls()). Then again loaded the data file using attach(). Now it is working fine – Rohitashva Raj Jul 07 '20 at 13:02