Error in T[, col] <- data[, col] : incorrect number of subscripts on matrix

I have a big issue for already a week. I cannot balance my classes with SMOTE as I am getting an error

Error in T[, col] <- data[, col] :
incorrect number of subscripts on matrix

This is the code I am applying:
smote_train <- SMOTE(Covid_tested ~., data = dataTrain, perc.over = 100, perc.under = 200)

I have almost approx 60.000 rows, with numerical variables and categorical ones.

Additionally, I get warning messages as well:

In addition: Warning messages:
1: In if (class(data[, col]) %in% c("factor", "character")) { :
the condition has length > 1 and only the first element will be used
2: In if (class(data[, col]) %in% c("factor", "character")) { :
the condition has length > 1 and only the first element will be used

Would you please help me? Did someone else got the same error? How did you solve it?

Can you please provide a minimal reprex (reproducible example)? The goal of a reprex is to make it as easy as possible for me to recreate your problem so that I can fix it: please help me help you!

If you've never heard of a reprex before, start by reading "What is a reprex", and follow the advice further down that page.

I have solved this issue by reading the data with read.csv and then transforming the variables into as.factor and as.numeric as relevant.

Hello Max. thank you for your concern. I have solved my problem but at the same time I also ticked it as problem solved.

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