Spliting training data into multiple variables using R So right now I am trying to create multiple variables with training data, and in the process I have reached an error


  Error in eval(predvars, data, env) : object '1.band1' not found


which is a product of these lines:

for(i in 1:length(data_split)){
 assign(paste("fit.lda",i, sep = ""), train(class~., data=data_split[i], 
 method="lda", metric=metric, trControl=control))}

is it something that I did wrong or is it something that can be fixed with another methodology

EDIT: 
My dataset is a data frame which was created by the following lines

validation_index &lt;- createDataPartition(valuetable$class, p=0.80, list=FALSE)
dataset &lt;- valuetable[validation_index,]

where valuetable is a dataframe which containes the values of multiple rasters.

Now, I wanted to split my data so my train function can be processed faster, that is because my machine's specs are pretty low, thus allowing me to re-create the later the results that would take time using other methods.

Let me know if you want more clarification.
You didn't explained how is your dataset and its variables, so I'll put a generic example.

Let's say your dataset has a variable called SET, whose content is TRN for training and TST for test. To create a dataset containing only training set you have to use the following code:

trn.ds&lt;- ds[ds$SET == 'TRN',]

If you need a test dataset, just adapt the code:

tst.ds&lt;- ds[ds$SET == 'TST']

PS: It wasn't me who downvoted your question, I don't understand why people downvote almost every question here.