[Rd] Adding Tcl source to an R package

Gabor Grothendieck ggrothendieck at gmail.com
Tue Aug 10 21:42:57 CEST 2010


On Tue, Aug 10, 2010 at 3:33 PM, Adrian Waddell <adrian at waddell.ch> wrote:
> Dear R Community,
>
> I'm writing an R package with a lot of Tcl and Tk code. I use the Tcl
> wrapper functions provided by the tcltk package if possible. However I
> also define "pure" Tcl functions. I so far defined them with the .Tcl
> function, for example (in R):
>
> .Tcl('proc test {a b} {
>  return [expr {sqrt(pow($a,2)+pow($b,2))}]
> }')
>
> so that I can use the procedures later on with either
>
> .Tcl('test 2 3')
> or
> tcl('test',2,3)
>
> My Question: Where can I put my procedures in a *.tcl file within my
> package structure and how do I make my R package to load the Tcl
> procedures? And will these functions be within a Tcl namespace?
>

Look at the Rpad package for an example. It sources tcl code.



More information about the R-devel mailing list