Created
August 28, 2015 00:52
-
-
Save mick001/2dbae06900b12553cf7c to your computer and use it in GitHub Desktop.
Gathering data script (R)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#------------------------------------------------------------------------------- | |
# Gathering the data | |
#------------------------------------------------------------------------------- | |
# Loading the entire mtcars dataset | |
data(mtcars) | |
# Subsetting the dataset for our use | |
dat <- subset(mtcars,select=c(mpg,disp,hp,drat,wt)) | |
dat | |
# Take a peek at the data plotting each feature against the other | |
plot(dat) | |
# Attach for rapid calls | |
attach(dat) | |
# Plot data to use | |
plot(disp,wt,type='p',xlab='Disp',ylab='Wt',main='Regression polynomials') | |
# Add a legend | |
legend("topleft",c("n=1","n=2","n=3"), col=c("red","green","blue"), lwd=3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment