Your verification ID is: guDlT7MCuIOFFHSbB3jPFN5QLaQ Big Computing: Plotting in R (scatter plot, multicolor and linear regression) - Part 1

Tuesday, October 7, 2014

Plotting in R (scatter plot, multicolor and linear regression) - Part 1

Plot is the most basic grapphing function in R. I typically use it as a scatter plot to look for a relationship between two variables. The classic example of this is uses the build in data set in R called cars which measures the braking distance of a car versus its speed.
plot of chunk unnamed-chunk-1
R’s format is very flexible. We could have also done plot(dist~speed,cars) or plot(cars[,1],cars[,2]) and gotten exact the same plot.
To test for a linear regression we might as well add the regression line to the plot
plot of chunk unnamed-chunk-2
Rarely in recent times is a data set so small. Most data sets we see today are large and messier than this one.

No comments:

Post a Comment