Error in if (any(co)) { : missing value where TRUE/FALSE needed in ksvm model

Hi everyone, I'm new to using R and I have an assignment in which I'm supposed to use SVM modeling for the classification of credit approval. I am using ksvm from the package kernlab per my professor's request. This is the dataset that I am using UCI Machine Learning Repository.

This is what I have so far:
`data$V16 <- as.factor(data$V16)

model <- ksvm(as.matrix(data[,1:15]), data[,16], type="C-svc",
kernel="vanilladot", C=100, scaled=TRUE)`

My professor said not to worry about splitting the data into train and test sets because we are not there yet. I keep getting the error: Error in if (any(co)) { : missing value where TRUE/FALSE needed . I've been looking for ways to fix it but all I can find is to change the class attribute to a factor which I have but it still throws the error anyway. I also checked if there were any null values in the dataset by using sum(is.na(data) to see if that was the issue but it returned 0.

Any help would be much appreciated!

HI @tvrjuana ,

can you post a snippet of (or all of the) data. That way it is easier to reproduce the behavior and give you some feedback of what went wrong.

Yes of course here are the first 10 rows:
V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13 V14 V15 V16
1 b 30.83 0.000 u g w v 1.250 t t 1 f g 00202 0 +
2 a 58.67 4.460 u g q h 3.040 t t 6 f g 00043 560 +
3 a 24.50 0.500 u g q h 1.500 t f 0 f g 00280 824 +
4 b 27.83 1.540 u g w v 3.750 t t 5 t g 00100 3 +
5 b 20.17 5.625 u g w v 1.710 t f 0 f s 00120 0 +
6 b 32.08 4.000 u g m v 2.500 t f 0 t g 00360 0 +
7 b 33.17 1.040 u g r h 6.500 t f 0 t g 00164 31285 +
8 a 22.92 11.585 u g cc v 0.040 t f 0 f g 00080 1349 +
9 b 54.42 0.500 y p k h 3.960 t f 0 f g 00180 314 +
10 b 42.50 4.915 y p w v 3.165 t f 0 t g 00052 1442 +

And here is the structure of the data

I also tried to convert the data type according to the .names file from the website where I downloaded the data, but even after converting the data types it still gave me the same error.

Here is the attribute information:

See if r - Error in if (any(co)) { : valor ausente donde TRUE/FALSE es necesario - Stack Overflow or r - Error in if (any(co)) { : missing value where TRUE/FALSE needed - Stack Overflow and the comments to those solutions are useful. They suggest that you have too many factor variables in your predictor data.

I was able to get it to work. There were too many factor variables. Thank you!