recipes for the dimensionality reduction methods failed in tidymodels package

Hi

I followed the procedure of parallel processing of different models in the tidymodels package (Chapter 16. Dimensionality Reduction), but got stuck at this step:

pls_rec <-
  data_rec %>%
  step_pls(all_numeric_predictors(), outcome = "Group", num_comp = tune()) 

I receive the error : 
Calling 'tune.spls'
Error: 'X' must be a numeric matrix (possibly including NA's) with finite values

My data looks like this:

> str (data)
'data.frame':	123 obs. of  30 variables:
 $ Group: chr  "Islands" "Islands" "Islands" "Islands" ...
 $ Al   : num  0.517 2.974 0.13 0.13 0.13 ...
 $ Ca   : num  13.1 96.1 120.1 17.6 11.6 ...
 $ Fe   : num  0.05 1.743 0.304 0.141 0.254 ...
 $ K    : num  4.27 7.28 68.42 243.33 233.05 ...
 $ Mg   : num  7.97 28.12 57.37 26.65 23.62 ...
 $ Na   : num  3.02 1.89 2.95 7.76 5.64 ...
 $ P    : num  1.19 4.04 6.6 23.53 20.56 ...
 $ S    : num  32.3 32.2 38.5 18 26.4 ...
 $ Ba   : num  0.0106 0.104 0.01 0.01 0.01 ...
 $ Cd   : num  0.0009 0.00195 0.000936 0.000944 0.0005 ...
 $ Co   : num  0.00101 0.00202 0.00202 0.00203 0.00101 ...
 $ Cr   : num  0.0215 0.0112 0.0025 0.0025 0.0025 ...
 $ Cs   : num  0.000581 0.000892 0.0005 0.0005 0.0005 ...
 $ Cu   : num  0.463 0.192 0.472 0.138 0.142 ...
 $ Mn   : num  0.0127 0.2067 0.061 0.0839 0.1031 ...
 $ Mo   : num  0.00811 0.00715 0.00415 0.00348 0.0033 ...
 $ Ni   : num  0.025 0.025 0.135 0.0702 0.025 ...
 $ Pb   : num  0.028 0.0533 0.0271 0.01 0.01 ...
 $ Rb   : num  0.00198 0.00602 0.08361 0.06402 0.18307 ...
 $ Sb   : num  0.00401 0.00398 0.00302 0.00203 0.00302 ...
 $ Sn   : num  0.0352 0.0104 0.01 0.0231 0.01 ...
 $ Sr   : num  0.0159 0.0501 0.039 0.005 0.005 ...
 $ Ti   : num  0.005 0.05247 0.005 0.00615 0.00689 ...
 $ V    : num  0.00203 0.00505 0.001 0.001 0.001 ...
 $ Zn   : num  0.399 0.342 0.456 0.825 0.279 ...
 $ Ce   : num  0.00406 0.0091 0.00202 0.00102 0.00101 ...
 $ La   : num  0.00101 0.00303 0.00101 0.0005 0.0005 ...
 $ Nd   : num  0.000602 0.006446 0.001281 0.0005 0.001056 ...
 $ Y    : num  0.0006 0.001734 0.001577 0.00035 0.000476 ...

Can anybody help me?

Thanks!
Mavro

Not sure but try converting Group to a factor.

Thank you Max for the quick answer and for all you do for this community.
I found out that the package mixOmics caused the problem. When I unloaded it, everything worked perfectly.

Best
Mavro

1 Like

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.