mercredi 28 juin 2017

Splitting data into test and train and not including all the column

I am working with the Auto data set in the ISLR library. How do I split the data into 75% train and 25% test. I think I split it right but I cant figure out howo to not include the two columns

Create a train and a test set

a. 75% train, 25% test

b. set seed to 1234 to get reproducible results

c. do not include columns “name” and “mpg” in the train and test sets

   splitTheData <- sample(nrow(Default), nrow(Default)*0.75, replace=FALSE)
   #3b
   set.seed(1234)

   #3c

Aucun commentaire:

Enregistrer un commentaire