0
$\begingroup$

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 <- createDataPartition(valuetable$class, p=0.80, list=FALSE) dataset <- 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.

$\endgroup$
1
  • $\begingroup$ What is data_split? Is it a list containing the data subsets? $\endgroup$
    – bradS
    Jul 16, 2018 at 8:12

1 Answer 1

0
$\begingroup$

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<- ds[ds$SET == 'TRN',]

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

tst.ds<- ds[ds$SET == 'TST']

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

$\endgroup$
1
  • $\begingroup$ I understand the confusion, most of the time users need more clarification. Now I added more information to my problem if you have any idea on how to solve my problem feel free to input your opinion or solution $\endgroup$
    – Ka_Papa
    Oct 18, 2017 at 12:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.