I tried to split the data(bank) into training data and test data. But I somehow got an error below.How can I solve this problem?
train = bank[1:100, ]
test =
Generally, you could achieve what you asked by doing something like this: Assume column 'response' is observed column:
samples=1:100
train = bank[samples, ]
test = bank[-samples,]
Status.test =bank[samples,'response']
BTW, I would suggest using sample()
function in order to take samples randomly for train and test. like this:
samples=sample(nrow(bank), 0.8*nrow(bank))
train = bank[samples, ]
test = bank[-samples,]
Status.test =bank[samples,'response']