From stvjc at channing.harvard.edu  Mon Jul 26 21:48:34 2004
From: stvjc at channing.harvard.edu (Vincent Carey 525-2265)
Date: Mon Jul 26 21:48:40 2004
Subject: [Rd] do.call and double-colon access
Message-ID: <Pine.GSO.4.58.0407261545180.13421@capecod.bwh.harvard.edu>


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?


[Rd] do.call and double-colon access
Vincent Carey 525-2265