0

I'm attempting to study Kernel PCA in a dataset and I have been trying the Kernlab package for R. The package has a method called "kpca". It works pretty well when I use it in R shell calling each command at a time. However, to make the process automatic, I created a script to do the same, but it raises errors. Here follow the script:

library("kernlab")
f1 <- read.table("dataset.txt")
kpc <- kpca(~., data=f1, kernel="rbfdot", kpar=list(sigma=0.2), features=5)

And the errors:

Error in km - colSums(km)/m : could not find function "loadMethod"
Calls: kpca ... kpca -> .local -> kpca -> kpca -> .local -> t -> t -> -
Execution halted

It seems that it cannot load a function or something related, but googleing that error doesn't give me anything. Does anybody know what is this?

Thiago
  • 694
  • 3
  • 12
  • 26
  • 1
    loadMethod should be part of **methods** package – milos.ai Aug 24 '15 at 13:52
  • Yep, just checked it here http://stackoverflow.com/questions/19680462/rscript-does-not-load-methods-package-r-does-why-and-what-are-the-consequen Apparently, Rscript does not load it, which is odd. Anyway, importing it solves the issue. Thanks! – Thiago Aug 24 '15 at 13:55

0 Answers0