how to use debug.mypkg

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

how to use debug.mypkg

cstrato
Dear all,

The package "affy" has the following statement in file "AffyBatch.R":
if (debug.affy123) cat("-->initAffyBatch\n")

This is great and I would also like to use it. However, when I run my
package
I get the following error:
Error in .local(object, ...) : object "debug.mypkg" not found

Since I am not able to find the position where "affy" defines
"debug.affy123"
my question is: where do I need to  define "debug.mypkg"?

Thank you in advance
Best regards
Christian
_._._._._._._._._._._._._._._._
C.h.i.s.t.i.a.n S.t.r.a.t.o.w.a
V.i.e.n.n.a       A.u.s.t.r.i.a
_._._._._._._._._._._._._._._._

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: how to use debug.mypkg

Benilton Carvalho
debug.affy123 is not a function... it's just a logical flag set in  
ProgressBarText.R.

b

On Mar 22, 2007, at 6:22 PM, cstrato wrote:

> Dear all,
>
> The package "affy" has the following statement in file "AffyBatch.R":
> if (debug.affy123) cat("-->initAffyBatch\n")
>
> This is great and I would also like to use it. However, when I run my
> package
> I get the following error:
> Error in .local(object, ...) : object "debug.mypkg" not found
>
> Since I am not able to find the position where "affy" defines
> "debug.affy123"
> my question is: where do I need to  define "debug.mypkg"?
>
> Thank you in advance
> Best regards
> Christian
> _._._._._._._._._._._._._._._._
> C.h.i.s.t.i.a.n S.t.r.a.t.o.w.a
> V.i.e.n.n.a       A.u.s.t.r.i.a
> _._._._._._._._._._._._._._._._
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: how to use debug.mypkg

cstrato
Yes, I know, but somewhere in my package I need to define this flag.
When I set the flag "debug.mypkg<-T" in the R session, everything works,
but the problem is that if I do not set it, it is undefined. So I need
to set it
initially in my package, but where?

Christian

Benilton Carvalho wrote:

> debug.affy123 is not a function... it's just a logical flag set in
> ProgressBarText.R.
>
> b
>
> On Mar 22, 2007, at 6:22 PM, cstrato wrote:
>
>> Dear all,
>>
>> The package "affy" has the following statement in file "AffyBatch.R":
>> if (debug.affy123) cat("-->initAffyBatch\n")
>>
>> This is great and I would also like to use it. However, when I run my
>> package
>> I get the following error:
>> Error in .local(object, ...) : object "debug.mypkg" not found
>>
>> Since I am not able to find the position where "affy" defines
>> "debug.affy123"
>> my question is: where do I need to  define "debug.mypkg"?
>>
>> Thank you in advance
>> Best regards
>> Christian
>> _._._._._._._._._._._._._._._._
>> C.h.i.s.t.i.a.n S.t.r.a.t.o.w.a
>> V.i.e.n.n.a       A.u.s.t.r.i.a
>> _._._._._._._._._._._._._._._._
>>
>> ______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: how to use debug.mypkg

Benilton Carvalho
it doesn't matter where..

just pick one of your files and set it...

of course, your file should be listed in the Collate field (in case  
you changed your mind and are now using it).

b

On Mar 22, 2007, at 6:52 PM, cstrato wrote:

> Yes, I know, but somewhere in my package I need to define this flag.
> When I set the flag "debug.mypkg<-T" in the R session, everything  
> works,
> but the problem is that if I do not set it, it is undefined. So I  
> need to set it
> initially in my package, but where?
>
> Christian
>
> Benilton Carvalho wrote:
>> debug.affy123 is not a function... it's just a logical flag set in  
>> ProgressBarText.R.
>>
>> b
>>
>> On Mar 22, 2007, at 6:22 PM, cstrato wrote:
>>
>>> Dear all,
>>>
>>> The package "affy" has the following statement in file  
>>> "AffyBatch.R":
>>> if (debug.affy123) cat("-->initAffyBatch\n")
>>>
>>> This is great and I would also like to use it. However, when I  
>>> run my
>>> package
>>> I get the following error:
>>> Error in .local(object, ...) : object "debug.mypkg" not found
>>>
>>> Since I am not able to find the position where "affy" defines
>>> "debug.affy123"
>>> my question is: where do I need to  define "debug.mypkg"?
>>>
>>> Thank you in advance
>>> Best regards
>>> Christian
>>> _._._._._._._._._._._._._._._._
>>> C.h.i.s.t.i.a.n S.t.r.a.t.o.w.a
>>> V.i.e.n.n.a       A.u.s.t.r.i.a
>>> _._._._._._._._._._._._._._._._
>>>
>>> ______________________________________________
>>> [hidden email] mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: how to use debug.mypkg

Seth Falcon-2
Benilton Carvalho <[hidden email]> writes:

> it doesn't matter where..
>
> just pick one of your files and set it...
>
> of course, your file should be listed in the Collate field (in case  
> you changed your mind and are now using it).

One useful trick is to create an environment object in your package's
namespace.  It is probably best to put this early in the Collate order
so all your code can assume it is there:

   OPTIONS <- new.env(hash=TRUE, parent=emptyenv())

Then you could have, for example, a debug flag that gets a default
value of FALSE, but can be interactively toggled.  In your package
code you would have:

   OPTIONS$debug <- FALSE

Then you could either export this object from your namespace or, more
conservatively, export a function to toggle.  Then an end user (or
developer) can do:

  R> toggleDebug()

Obviously, for this to be useful, you need to have package code that
checks if(OPTIONS$debug) and does something different.

+ seth

--
Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center
http://bioconductor.org

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: how to use debug.mypkg

Benilton Carvalho
Great tip Seth...

thanks a bunch...

b

On Mar 22, 2007, at 9:54 PM, Seth Falcon wrote:

> Benilton Carvalho <[hidden email]> writes:
>
>> it doesn't matter where..
>>
>> just pick one of your files and set it...
>>
>> of course, your file should be listed in the Collate field (in case
>> you changed your mind and are now using it).
>
> One useful trick is to create an environment object in your package's
> namespace.  It is probably best to put this early in the Collate order
> so all your code can assume it is there:
>
>    OPTIONS <- new.env(hash=TRUE, parent=emptyenv())
>
> Then you could have, for example, a debug flag that gets a default
> value of FALSE, but can be interactively toggled.  In your package
> code you would have:
>
>    OPTIONS$debug <- FALSE
>
> Then you could either export this object from your namespace or, more
> conservatively, export a function to toggle.  Then an end user (or
> developer) can do:
>
>   R> toggleDebug()
>
> Obviously, for this to be useful, you need to have package code that
> checks if(OPTIONS$debug) and does something different.
>
> + seth
>
> --  
> Seth Falcon | Computational Biology | Fred Hutchinson Cancer  
> Research Center
> http://bioconductor.org
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: how to use debug.mypkg

Paul Gilbert
In reply to this post by Seth Falcon-2
Here is the way I do something similar in my dse1 package:

..onLoad  <- function(library, section) {
    .DSEflags(list(COMPILED=TRUE, DUP=TRUE))
    invisible(TRUE)
    }

..DSEflags <- local({
    .DSE.flags <- character(0)
    function(new) {
        if(!missing(new))
            .DSE.flags <<- new
        else
            .DSE.flags
        }
})

This was suggested to me a few years ago (by Kurt I think).  It works
well.  A call to .DSEflags() displays the settings and a list argument
sets them.

Paul

Seth Falcon wrote:

> Benilton Carvalho <[hidden email]> writes:
>
>> it doesn't matter where..
>>
>> just pick one of your files and set it...
>>
>> of course, your file should be listed in the Collate field (in case  
>> you changed your mind and are now using it).
>
> One useful trick is to create an environment object in your package's
> namespace.  It is probably best to put this early in the Collate order
> so all your code can assume it is there:
>
>    OPTIONS <- new.env(hash=TRUE, parent=emptyenv())
>
> Then you could have, for example, a debug flag that gets a default
> value of FALSE, but can be interactively toggled.  In your package
> code you would have:
>
>    OPTIONS$debug <- FALSE
>
> Then you could either export this object from your namespace or, more
> conservatively, export a function to toggle.  Then an end user (or
> developer) can do:
>
>   R> toggleDebug()
>
> Obviously, for this to be useful, you need to have package code that
> checks if(OPTIONS$debug) and does something different.
>
> + seth
>
====================================================================================

La version fran├žaise suit le texte anglais.

------------------------------------------------------------------------------------

This email may contain privileged and/or confidential inform...{{dropped}}

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: how to use debug.mypkg

cstrato
In reply to this post by Benilton Carvalho
Thank you all for your suggestions, I have implemented the OPTIONS "option",
since it allows to define other options, too.

Yes, I use now the Collate field, since it gives me the possibility to
organize my
files in the way I want.

Best regards
Christian

Benilton Carvalho wrote:

> it doesn't matter where..
>
> just pick one of your files and set it...
>
> of course, your file should be listed in the Collate field (in case
> you changed your mind and are now using it).
>
> b
>
> On Mar 22, 2007, at 6:52 PM, cstrato wrote:
>
>> Yes, I know, but somewhere in my package I need to define this flag.
>> When I set the flag "debug.mypkg<-T" in the R session, everything works,
>> but the problem is that if I do not set it, it is undefined. So I
>> need to set it
>> initially in my package, but where?
>>
>> Christian
>>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel