Re: [Rd] package NAMESPACE question

2014-01-29 Thread Therneau, Terry M., Ph.D.
For the special tt mark in a formula, the answer is "mine". Other than that coxph handles formulas in a completely standard way. I don't see any other solution, frankly, unless I want to get really complex. If formulas were not handled in an odd way, I'd simply add tt() to my namespace, not e

Re: [Rd] package NAMESPACE question

2014-01-29 Thread Duncan Murdoch
On 29/01/2014 9:20 AM, Therneau, Terry M., Ph.D. wrote: An example of this is found in the coxph function in the survival library. Look at it for guideance. Within a coxph formula the expression "tt(x)" means to use a time transform on variable x. The tt function is a fake, defined as tt <-

Re: [Rd] package NAMESPACE question

2014-01-29 Thread Therneau, Terry M., Ph.D.
An example of this is found in the coxph function in the survival library. Look at it for guideance. Within a coxph formula the expression "tt(x)" means to use a time transform on variable x. The tt function is a fake, defined as tt <- function(x) x, whose only purpose is to allow the user to

Re: [Rd] package NAMESPACE question

2014-01-28 Thread Hervé Pagès
Hi Alex, On 01/28/2014 03:32 AM, Axel Urbiz wrote: Hi, I've tried to put together a simpler example where I'm having the issue. I've built a foo package by only including a single .R file with the two functions listed below: trt and cmt. The second function calls the first. In the namespace fi

Re: [Rd] package NAMESPACE question

2014-01-28 Thread Duncan Murdoch
sson > Cc: r-devel > Subject: Re: [Rd] package NAMESPACE question > > On 28/01/2014 12:15 PM, William Dunlap wrote: > > You can more or less get what you want by reassigning the environment > > of the formula to be a child of its original environment, where you put &

Re: [Rd] package NAMESPACE question

2014-01-28 Thread William Dunlap
obal effects since environments are > reference objects). > > I don't see a good solution here. I would change the requirements. > > Duncan Murdoch > > > > Bill Dunlap > > TIBCO Software > > wdunlap tibco.com > > > > > > > -O

Re: [Rd] package NAMESPACE question

2014-01-28 Thread Duncan Murdoch
nments are reference objects). I don't see a good solution here. I would change the requirements. Duncan Murdoch Bill Dunlap TIBCO Software wdunlap tibco.com > -Original Message- > From: r-devel-boun...@r-project.org [mailto:r-devel-boun...@r-project.org] On Behalf &g

Re: [Rd] package NAMESPACE question

2014-01-28 Thread William Dunlap
; Behalf > Of Axel Urbiz > Sent: Tuesday, January 28, 2014 3:33 AM > To: Henrik Bengtsson > Cc: r-devel > Subject: Re: [Rd] package NAMESPACE question > > Hi, > > I've tried to put together a simpler example where I'm having the issue. > > I've b

Re: [Rd] package NAMESPACE question

2014-01-28 Thread Axel Urbiz
Thanks for all your help on this Duncan. Much appreciated! Regards Axel On Tuesday, January 28, 2014, Duncan Murdoch wrote: > On 14-01-28 6:32 AM, Axel Urbiz wrote: > >> Hi, >> >> I've tried to put together a simpler example where I'm having the issue. >> >> I've built a foo package by only inc

Re: [Rd] package NAMESPACE question

2014-01-28 Thread Axel Urbiz
Hi, I've tried to put together a simpler example where I'm having the issue. I've built a foo package by only including a single .R file with the two functions listed below: trt and cmt. The second function calls the first. In the namespace file, if I only export(cmt), I get the following error m

Re: [Rd] package NAMESPACE question

2014-01-28 Thread Duncan Murdoch
On 14-01-28 6:32 AM, Axel Urbiz wrote: Hi, I've tried to put together a simpler example where I'm having the issue. I've built a foo package by only including a single .R file with the two functions listed below: trt and cmt. The second function calls the first. In the namespace file, if I only

Re: [Rd] package NAMESPACE question

2014-01-26 Thread Henrik Bengtsson
On Sun, Jan 26, 2014 at 6:34 AM, Axel Urbiz wrote: > Hi Duncan, > > My most sincere apologies. It's really not my intention to waste anyones > time. More the opposite...for some reason I thought that the problem had to > do with my call to options() and thought that would be enough. Here's > somet

Re: [Rd] package NAMESPACE question

2014-01-26 Thread Duncan Murdoch
On 14-01-26 9:34 AM, Axel Urbiz wrote:> Hi Duncan, > > My most sincere apologies. It's really not my intention to waste anyones > time. More the opposite...for some reason I thought that the problem had > to do with my call to options() and thought that would be enough. Here's > something reproduc

Re: [Rd] package NAMESPACE question

2014-01-26 Thread Axel Urbiz
Hi Duncan, My most sincere apologies. It's really not my intention to waste anyones time. More the opposite...for some reason I thought that the problem had to do with my call to options() and thought that would be enough. Here's something reproducible: I built a foo package based on the code und

Re: [Rd] package NAMESPACE question

2014-01-26 Thread Duncan Murdoch
On 14-01-25 6:05 PM, Axel Urbiz wrote: Thanks again all. Essentially, this is the section of the code that is causing trouble. This is part of the (exported) function which calls contr.none (not exported). As mentioned, when I call the exported function it complains with the error described befor

Re: [Rd] package NAMESPACE question

2014-01-25 Thread Axel Urbiz
Thanks again all. Essentially, this is the section of the code that is causing trouble. This is part of the (exported) function which calls contr.none (not exported). As mentioned, when I call the exported function it complains with the error described before. oldcontrasts <- unlist(options("co

Re: [Rd] package NAMESPACE question

2014-01-25 Thread Axel Urbiz
Thanks Gabriel. Your explanation is very clear. Seeing the example above, I made a mistake. If I export(timestwo) (and not multiply), then calling timestwo in the package works fine. However, in my real package I have a situation like the above: contr.none <- function(n, contrasts) { if (leng

Re: [Rd] package NAMESPACE question

2014-01-25 Thread Duncan Murdoch
On 14-01-25 2:47 PM, Axel Urbiz wrote: Thanks Dirk. Sorry...It's my misunderstanding about "export" in the NAMESPACE then. Essentially, as I understand it now, I should export all functions that are used in the package? Why would I not export a certain function? In the example above, say I wante

Re: [Rd] package NAMESPACE question

2014-01-25 Thread Gabriel Becker
I haven't seen all of your code, but are you using get to obtain the object yourself? If so, that is likely your problem, as that is (roughly) equivalent to typing the name at the prompt, it won't see unexported functions. It shouldn't be necessary to do, though. contrasts = switch(ctr, "contr.non

Re: [Rd] package NAMESPACE question

2014-01-25 Thread Gabriel Becker
Axel, R CMD check and CRAN's submission guidelines do not allow undocumented *user facing* (i.e. exported) functions or objects in packages. If you want the users of your package to be able calling the timestwo function directly, it needs to be documented (and exported). If, on the other hand, t

Re: [Rd] package NAMESPACE question

2014-01-25 Thread Axel Urbiz
Thanks Dirk. Sorry...It's my misunderstanding about "export" in the NAMESPACE then. Essentially, as I understand it now, I should export all functions that are used in the package? Why would I not export a certain function? In the example above, say I wanted to avoid documenting the function "time

Re: [Rd] package NAMESPACE question

2014-01-25 Thread Axel Urbiz
Dirk and Uwe, many thanks both for your responses. I'm still having the same issue. Here's in more detail: As Dirk suggested, I've done the following: * I've created a package named {foo}. * {foo} only has one file named test.R which includes exactly the following code: multiply <- function(x,y

Re: [Rd] package NAMESPACE question

2014-01-25 Thread Dirk Eddelbuettel
On 25 January 2014 at 20:26, Axel Urbiz wrote: | Dirk and Uwe, many thanks both for your responses. I'm still having the same | issue. Here's in more detail: | | As Dirk suggested, I've done the following: | | * I've created a package named {foo}.  | | * {foo} only has one file named test.R whi

Re: [Rd] package NAMESPACE question

2014-01-25 Thread Uwe Ligges
On 25.01.2014 14:53, Dirk Eddelbuettel wrote: On 25 January 2014 at 14:38, Axel Urbiz wrote: | Hello, | | I'm building a package. My code is stored in foo.R. This code has two | functions FUN1 and FUN2. FUN1 calls FUN2. FUN1 is listed in export() under | the package NAMESPACE but NOT FUN2. Aft

Re: [Rd] package NAMESPACE question

2014-01-25 Thread Dirk Eddelbuettel
On 25 January 2014 at 14:38, Axel Urbiz wrote: | Hello, | | I'm building a package. My code is stored in foo.R. This code has two | functions FUN1 and FUN2. FUN1 calls FUN2. FUN1 is listed in export() under | the package NAMESPACE but NOT FUN2. After building the package when I call | FUN1 is giv