knitr keeps failing

I am trying to make an HTML file from a RStudio notebook.

I keep getting the error


The code on line 252 is below

varimp_mars
Any help would be appreciated.

Is there a problem with that line? Without more context it is impossible to help.

If you are absolute sure that the code works, then it might be a cache issue. Try cleaning the cache in Preview ("Clear knitr cache...") and then knit the notebook again.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

Hi!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

Thank you !

The code works. I do get figures in html but no notebook.

Tried clearing the cache but that didn’t help.

Error is "Error in Line 348 train.default(x, y …Execution halted.”

I Tried to attach the file but it wasn't allowed.
Here is some of the code

dim(testData)
sum(is.na(testData))
# Step 1: Impute missing values 
preProcess_missingdata_model <- preProcess(testData, method='knnImpute')
testData2 <- predict(preProcess_missingdata_model,testData)  
sum(is.na(testData2))
# Step 2: Create one-hot encodings (dummy variables)
testData3 <- predict(dummies_model, testData2)
is.factor(testData3)
# Step 3: Transform the features to range between 0 and 1
testData4 <- predict(preProcess_range_model, testData3)

# View
head(testData4)

# Predict on testData
predicted2 <- predict(model_mars, testData4)
head(predicted2)
###6.5. Confusion Matrix

###The confusion matrix is a tabular representation to compare the predictions (data) vs the actuals (reference). By setting mode='everything' pretty much most classification evaluation metrics are computed.

# Compute the confusion matrix
confusionMatrix(reference = testData$Purchase, data = predicted2, mode='everything', positive='MM')
set.seed(100)
model_mars2 = train(Purchase ~ ., data=trainData, method='earth', tuneLength = 5, metric='ROC', trControl = fitControl)
model_mars2

# Step 2: Predict on testData and Compute the confusion matrix

confusionMatrix(reference = testData$Purchase, data = predicted2, mode='everything', positive='MM')

line 348 was "set.seed(100) is the last block.

I’m frustrated. This has worked in the past.

Thanks

Theo