Hi,
Use sample or sample.split function to create train and test data.
For example:
split = sample.split(db$Class.variable,0.6)
train = subset(db,split==T)
test = subset(db,split==F)
split_data=sample(1:nrow(db),0.6*nrow(db))
train_data = db[split_data,]
test_data = db[-split_data,]