[Rd] do.call and double-colon access

From: Vincent Carey 525-2265 <stvjc_at_channing.harvard.edu>
Date: Tue 27 Jul 2004 - 05:48:34 EST

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?



R-devel@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-devel Received on Tue Jul 27 05:58:28 2004

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 08:59:12 EST