Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

could not find function "dimRedMethodList" #6

Closed
topepo opened this issue Feb 2, 2017 · 6 comments
Closed

could not find function "dimRedMethodList" #6

topepo opened this issue Feb 2, 2017 · 6 comments

Comments

@topepo
Copy link
Contributor

topepo commented Feb 2, 2017

I'm creating a package that imports dimRed and I'm getting an error ("Error in eval(expr, envir, enclos) : could not find function "dimRedMethodList") when invoking this code:

#' @importFrom dimRed Isomap dimRedData embed

foo <- function(x, training, ...) {
  imap <- embed(dimRedData(training)), 
                "Isomap", knn = x$options$knn, 
                ndim = x$num, .mute = x$options$.mute)
}

I know that this isn't reproducible but it otherwise works when using Isomap directly instead of embed(,"Isomap"). I've tried importing dimRedMethodList too but had the same error. Loading the package prior to invoking this function also works.

@gdkrmr
Copy link
Owner

gdkrmr commented Feb 3, 2017

That is very strange, I export dimRedMethodList just as any other function and it isn't even a method.

From your error message I would think that this is unrelated, but try running:

names(completeClassDefinition("dimRedMethod", doExtends = FALSE)@subclasses)

from inside your package. You might need to import the classes dimRedMethod and all children (or maybe just the methods you are using) separately.

Have you tried calling dimRed::embed(...)?

@topepo
Copy link
Contributor Author

topepo commented Feb 7, 2017

I added a print statement for that line and get output before the error:

 [1] "DiffusionMaps"       "DRR"                 "FastICA"             "KamadaKawai"        
 [5] "DrL"                 "FruchtermanReingold" "HLLE"                "Isomap"             
 [9] "kPCA"                "LaplacianEigenmaps"  "LLE"                 "MDS"                
[13] "nMDS"                "PCA"                 "tSNE"               
Error in eval(expr, envir, enclos) : 
  could not find function "dimRedMethodList"

Calling as dimRed::embed had the same results.

It is weird... before loading dimRed I can access it via dimRed::dimRedMethodList and dimRed:::dimRedMethodList. Even more, I imported the whole dimRed package and still get the same error.

I'll figure out how to convert over to non-embed code. Can .mute be passed into the @fun and @apply functions?

topepo added a commit to tidymodels/recipes that referenced this issue Feb 7, 2017
@gdkrmr
Copy link
Owner

gdkrmr commented Feb 8, 2017

that is strange, I will try this myself when I find some time.
You can look at the implementation of the embed function and simply copy the code I use for muting: https://github.com/gdkrmr/dimRed/blob/master/R/embed.R#L115

You are trying to use Isomap? I had some problems with the CVST package I use for the DRR method and had to import the whole thing because of namespace issues.

Another weird namespace hack I had to do is here, maybe it helps :
https://github.com/gdkrmr/dimRed/blob/master/R/kpca.R#L116

@gdkrmr
Copy link
Owner

gdkrmr commented Feb 8, 2017

I can reproduce it without a package:

  dimRed::embed(dimRed::dimRedData(iris[1:4]),
                "Isomap", knn = 25,
                ndim = 2, .mute = "")

in a fresh R session gives the same error.

gdkrmr added a commit that referenced this issue Feb 8, 2017
@gdkrmr
Copy link
Owner

gdkrmr commented Feb 8, 2017

fixed with 36f4975

@gdkrmr gdkrmr closed this as completed Feb 8, 2017
@topepo
Copy link
Contributor Author

topepo commented Feb 8, 2017

It works for me. Thanks

topepo added a commit to tidymodels/recipes that referenced this issue Feb 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants