Skip to content

Instantly share code, notes, and snippets.

@karan19100
Created July 18, 2020 20:56
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save karan19100/8b5dbb8949d8cd745e0e23fbca1d1c14 to your computer and use it in GitHub Desktop.
step1_for_predicting_linear_model_by_karanshah
set.seed(123) # setting seed to reproduce results of random sampling
trainingRowIndex <- sample(1:nrow(newdata2), 0.7*nrow(newdata2)) # training and testing: 70/30 split
trainingData <- newdata2[trainingRowIndex, ] # training data
testData <- newdata2[-trainingRowIndex, ] # test data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment