Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gathering data script (R)
#-------------------------------------------------------------------------------
# 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