[Rd] do.call and double-colon access

Vincent Carey 525-2265 stvjc at channing.harvard.edu
Mon Jul 26 21:48:34 CEST 2004


Using R 2.0.0 of July 20 2004

train, test, and cl as defined in example(knn),

we have

> search()
[1] ".GlobalEnv"       "package:methods"  "package:stats"    "package:graphics"
[5] "package:utils"    "Autoloads"        "package:base"
> knn(train, test, cl, k=3)
Error: couldn't find function "knn"
> class::knn(train, test, cl, k=3)
 [1] s s s s s s s s s s s s s s s s s s s s s s s s s c c v c c c c c v c c c c
[39] c c c c c c c c c c c c v c c v v v v v v v v v v c v v v v v v v v v v v
Levels: c s v
> do.call("class::knn", list(train=train, test=test, cl=cl, k=3))
Error in do.call("class::knn", list(train = train, test = test, cl = cl,  :
        couldn't find function "class::knn"
> library(class)
> do.call("knn", list(train=train, test=test, cl=cl, k=3))
 [1] s s s s s s s s s s s s s s s s s s s s s s s s s c c v c c c c c v c c c c
[39] c c c c c c c c c c c c v c c v v v v v c v v v v c v v v v v v v v v v v
Levels: c s v


should do.call("class::knn", ...) succeed?



More information about the R-devel mailing list