0

I created an svm formula using my training data:

library(e1071)

modeltrain <- svm(Y~ X1 + as.factor(X2) + X3, data=traindata,
                  type="nu-regression",kernel="radial",cross=10, nu = 0.30, gamma=0.1)

Which I then use to generate predictions in my test data:

predict(modeltrain, testdata)

This has worked just fine on multiple machines, but when I send this formula to one of my collaborators and he tries to run the 'predict' function, he gets the following error:

"Error in predict.svm(modelcold, cold) : object 'R_svmpredict' not found"

Note that: - there is no missing in his test data - all variables have been checked and they match the training data - he has both the latest versions of R and Rtudio installed - we've tried loading different versions of the model and restarting RStudio

I've searched online for help but the one answer I found was confusing: Object not found error when passing model formula to another function

Frankly, we're both stumped. Any feedback would be greatly appreciated.

--- As requested, adding sessionInfo() output:

R version 3.4.2 (2017-09-28) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 > LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] mgcv_1.8-20 nlme_3.1-131 e1071_1.6-8 dplyr_0.7.4 foreign_0.8-69

loaded via a namespace (and not attached): [1] Rcpp_0.12.13 lattice_0.20-35 class_7.3-14 assertthat_0.2.0 > grid_3.4.2 R6_2.2.2 magrittr_1.5 rlang_0.1.2 bindrcpp_0.2
[10] Matrix_1.2-11 tools_3.4.2 glue_1.1.1 compiler_3.4.2 >pkgconfig_2.0.1 bindr_0.1 tibble_1.3.4

Yara
  • 1
  • 3
  • Can you post the data so that we can reproduce the error? – Dan Oct 25 '17 at 21:05
  • Unfortunately no as the data is private. Here's the thing though, I can't reproduce this error on my computer but I've seen it on his. So I have no idea what the issue could be. – Yara Oct 25 '17 at 21:15
  • Can he reproduce the error with a different, publicly-available data set? Can he share his `sessionInfo()`? – Dan Oct 25 '17 at 22:39
  • As requested, here is the session info: – Yara Oct 26 '17 at 17:38
  • I don't see the `sessionInfo()`. Also, could he reproduce the error with another [dataset](https://stat.ethz.ch/R-manual/R-devel/library/datasets/html/00Index.html)? This would help determine if it's a problem specific to the dataset, as opposed to the functions/packages. – Dan Oct 26 '17 at 17:47
  • Ok, updating my comment now. Was trying to run with another dataset and post before saving. – Yara Oct 26 '17 at 18:12
  • If he runs `e1071:::R_svmpredict` what output does he get? – Dan Oct 26 '17 at 18:41

1 Answers1

0

Thank you everyone for your responses. What ended up working was uninstalling the e1071 package and deleting the folder from the lib, and then reinstalling it again. Worked without a hitch.

Yara
  • 1
  • 3
  • My guess is that `R_svmpredict` – a C function called from the `e1071` package – was (for some reason) missing. (It's hidden, hence the triple `:` to call it and see if it exists.) – Dan Oct 30 '17 at 11:20