Error with plotting graphs for regression models

I'm working with regression models. Developed the linear model in R. However in plotting the graph I am facing an error of the 'x' and 'y' lengths not being equal. This isn't a problem when using excel so I was wondering if there's a way to get rid of this error

Hi there, and welcome to community.rstudio.com!

Without knowing what your code and data look like, it's a little difficult to give good guidance. To help you get the right help for your question, can you please turn it into a reprex (reproducible example)? This will ensure we're all looking at the same data and code. A guide for creating a reprex can be found here.

I Wish I could but the data I'm working on is confidential

Ideally, you would construct a reproducible example using one of R's many built-in datasets, or using synthetic data you generated yourself. At the very least, though, can you share the code you are running and the output that's causing trouble? It's very difficult to understand code problems from a prose description.

For instance, in this case I'm not sure if the above bit means that you are getting a specific error message, or if it means that the plot somehow doesn't look the way you want it to — or something else entirely?

1 Like