I'm a beginner at R and RStudio and I'm trying to make a frequency polygon on top of a histogram using the "cars" dataset.
hist(speed)
lines(speed, lwd=2, col = "royalblue")
This is the output I'm getting.
What I need is the points coming properly on top of the histogram. I have seen this one using plots but I can't get to use it in my code.