[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 204
  • Last Modified:

How to fix Error with Caret library and preProcess()

Hi, I am getting the following error:
Error in if (any(scaleValue == 0)) { : 
  missing value where TRUE/FALSE needed

Open in new window


How can I fix it?  Thank you.

my code:
library(caret)
# read data
features.adj.dfm1<-read.table("features_adj_dfm1k.txt",sep=" ",header=T,stringsAsFactors=F)

###### error after this function
trans<-preProcess(features.adj.dfm1,method=c("BoxCox","center","scale"),na.remove=T)

Open in new window

features-adj-dfm1k.txt
0
pgmerLA
Asked:
pgmerLA
1 Solution
 
Thibault St john Cholmondeley-ffeatherstonehaugh the 2ndCommented:
That text file is massive, and too big to read on my phone. All I see is a lot of numbers.

From your first Code showing the error it is telling you that the if statement is malformed.
It should be of the form:
If (condition, what if true, what if false)

Your second code entry doesn't show the line with that if statement.

As you have included an Any () statement in the if, I would suggest that you have miscounted the brackets and closed the if without including the true/false parameters.

you will need to post that actual line for me to check fully, but you can probably find it yourself if you count the braces.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now