I used the code from this answer to split my train data into two sets.
trainLabels <- read.csv(trainLabels.file, stringsAsFactors=F, header=FALSE)
> str(trainLabels)
'data.frame': 1000 obs. of 1 variable:
$ V1: int 1 0 0 1 0 1 0 1 1 0 ...
trainLabelsTrain <- trainLabels[train_ind, ]
trainLabelsTest <- trainLabels[-train_ind, ]
> str(trainLabelsTrain)
int [1:750] 0 1 0 0 0 0 1 1 1 0 ...
Then I would like to have a data.frame just like the original data (trainLabels
).
How can I get a data.frame?