Good day .All is fine when working within Rstudio/RMD . I only get error message when trying to Knit to Word . The Knit process stops when it gets to the "preProcess()" function from Caret. I have checked the syntax and loading of relevant packages to no avail . I'm at a dead-end . Can somebody help?
R Code for Caret :
##Determine the means and sd's and Use the Predict() function to do the adjustments
Error Message :
Quitting from lines 864-872 (InsuranceDefault4a.Rmd)
Error in complete.cases(x) : not all arguments have the same length
Calls: ... preProcess.default -> [ -> [.data.frame -> complete.cases
It seems indeed there is an issue with your dataset trainSet that preProcess will try to modify using complete.cases.
Hints:
When you click on the knit button, your document is rendered in a clean new R session. So nothing from your current workspace is available, everything must be working from your chunks.
You could try restarting your R session in a clean state and try rerunning the chunks in the Rmd, you should find the same error within RStudio/RMD as you said.
Hi Cderv , I have redone . Getting same error message .I now note that though its working in normal Rstudio its not working when I code chunk in RMD . Meaning the underlying dataset in trainSet is not the problem . So , what could be the problem?