Skip to content

Instantly share code, notes, and snippets.

@mick001
Created August 28, 2015 00:52
Show Gist options
  • Save mick001/2dbae06900b12553cf7c to your computer and use it in GitHub Desktop.
Save mick001/2dbae06900b12553cf7c to your computer and use it in GitHub Desktop.
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