Re: [R-pkg-devel] two functions with the same name when importing

2019-11-07 Thread Martin Morgan
RShowDoc("R-exts") setion 1.5.1 Specifying imports and exports indicates that 
imports() has an except= argument, so

import(adegenet, except = plot)

might do the trick. Use it in your package as `adegenet::plot()`. 

Martin Morgan

On 11/6/19, 8:31 PM, "R-package-devel on behalf of Duncan Murdoch" 
 
wrote:

On 06/11/2019 6:50 p.m., Bernd.Gruber wrote:
> Hi,
> 
> I have a problem regarding the name of two functions and I know the 
"correct" way is to use importFrom to make sure only specified functions are 
imported. But my problem is that my package really depends on another package
> adegenet as I basically use 90% of the say >100 functions.
> 
> So when I import all of adegenet I get:
> 
> 2: replacing previous import 'adegenet::plot' by 'graphics::plot' when 
loading 'dartR'
> 
> 
> So in essence I think adegenet is importing a plot function which 
collides with the basic plot function. Is there anything I can do, without 
going through 100 functions and using importFrom
> 
> In addition I actually need the plot function from adegenet, so I would 
need to rename it as well somehow.
> 
> Any hint how to solve this would be highly appreciated.

Just get a copy of the adegenet NAMESPACE file to get all of its 
exports.  Edit the list down to the ones you use, and use a text editor 
to change the export directives to importFrom directives.  It's not 
really that hard.

The path to the NAMESPACE file is given by

system.file("NAMESPACE", package="adegenet")

Duncan Murdoch

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] two functions with the same name when importing

2019-11-07 Thread Bernd . Gruber
@Martin Morgan

Thanks to your hint if found this:

@rawNamespace import(adegenet, except = plot)

which works beautifully  and no need to go through each Namespace function.

Thanks again to everyone.




From: Martin Morgan 
Sent: Thursday, 7 November 2019 8:34 PM
To: Duncan Murdoch ; Bernd.Gruber 
; r-package-devel@r-project.org
Subject: Re: [R-pkg-devel] two functions with the same name when importing

RShowDoc("R-exts") setion 1.5.1 Specifying imports and exports indicates that 
imports() has an except= argument, so

import(adegenet, except = plot)

might do the trick. Use it in your package as `adegenet::plot()`.

Martin Morgan

On 11/6/19, 8:31 PM, "R-package-devel on behalf of Duncan Murdoch" 
mailto:r-package-devel-boun...@r-project.org%20on%20behalf%20of%20murdoch.dun...@gmail.com>>
 wrote:

On 06/11/2019 6:50 p.m., Bernd.Gruber wrote:
> Hi,
>
> I have a problem regarding the name of two functions and I know the "correct" 
> way is to use importFrom to make sure only specified functions are imported. 
> But my problem is that my package really depends on another package
> adegenet as I basically use 90% of the say >100 functions.
>
> So when I import all of adegenet I get:
>
> 2: replacing previous import 'adegenet::plot' by 'graphics::plot' when 
> loading 'dartR'
>
>
> So in essence I think adegenet is importing a plot function which collides 
> with the basic plot function. Is there anything I can do, without going 
> through 100 functions and using importFrom
>
> In addition I actually need the plot function from adegenet, so I would need 
> to rename it as well somehow.
>
> Any hint how to solve this would be highly appreciated.

Just get a copy of the adegenet NAMESPACE file to get all of its
exports. Edit the list down to the ones you use, and use a text editor
to change the export directives to importFrom directives. It's not
really that hard.

The path to the NAMESPACE file is given by

system.file("NAMESPACE", package="adegenet")

Duncan Murdoch

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


[R-pkg-devel] How to Document and S3 Method for the Parenthesis Class?

2019-11-07 Thread bill
Hi,

 

Short version of the question:  How does one document a method for the "("
class in a .Rd file?

 

Details:

I recently contributed to the digest package functions to assist with
generating sha1 hashes for formula objects.  Sometimes within formula, the
parenthesis ("(") class is used, for example [1]:

 

> class((a~(b+c))[[3]])

[1] "("

 

So, I wrote a method to handle that class, too.  When trying to document it
in the .Rd file, I tried the following code, but when checking the
documentation, it gets an error:

 

\method{sha1}{"("}(x, digits = 14, zapsmall = 7, ..., algo = "sha1")

 

The error when checking the documentation is:

 

> checking Rd \usage sections ... WARNING

  Bad \usage lines found in documentation object 'sha1':

method{sha1}{"("}(x, digits = 14, zapsmall = 7, ...,
algo = "sha1")

  

  Functions with \usage entries need to have the appropriate \alias

  entries, and all their arguments documented.

  The \usage entries must correspond to syntactically valid R code.

  See chapter 'Writing R documentation files' in the 'Writing R

  Extensions' manual.

 

I have tried variants of escaping the parenthesis like "\(" and "\\(" and
the unescaped variant "(", too.

 

Thanks,

 

Bill

 

[1] In case the first thought is, "don't write formula which have a full
side within redundant parentheses", something equivalent to this was created
by update.formula().


[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] How to Document and S3 Method for the Parenthesis Class?

2019-11-07 Thread Duncan Murdoch

On 07/11/2019 9:35 a.m., b...@denney.ws wrote:

Hi,

  


Short version of the question:  How does one document a method for the "("
class in a .Rd file?

  


Details:

I recently contributed to the digest package functions to assist with
generating sha1 hashes for formula objects.  Sometimes within formula, the
parenthesis ("(") class is used, for example [1]:

  


class((a~(b+c))[[3]])


[1] "("

  


So, I wrote a method to handle that class, too.  When trying to document it
in the .Rd file, I tried the following code, but when checking the
documentation, it gets an error:

  


\method{sha1}{"("}(x, digits = 14, zapsmall = 7, ..., algo = "sha1")


I think this should work:

  \method{sha1}{`(`}(x, digits = 14, zapsmall = 7, ..., algo = "sha1")

A quick test case gave me errors from not documenting the args, but not 
the bad \usage line error described below.


Duncan Murdoch



  


The error when checking the documentation is:

  


checking Rd \usage sections ... WARNING


   Bad \usage lines found in documentation object 'sha1':

 method{sha1}{"("}(x, digits = 14, zapsmall = 7, ...,
algo = "sha1")

   


   Functions with \usage entries need to have the appropriate \alias

   entries, and all their arguments documented.

   The \usage entries must correspond to syntactically valid R code.

   See chapter 'Writing R documentation files' in the 'Writing R

   Extensions' manual.

  


I have tried variants of escaping the parenthesis like "\(" and "\\(" and
the unescaped variant "(", too.

  


Thanks,

  


Bill

  


[1] In case the first thought is, "don't write formula which have a full
side within redundant parentheses", something equivalent to this was created
by update.formula().


[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel



__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] How to Document and S3 Method for the Parenthesis Class?

2019-11-07 Thread Jeff Newmiller
There are three types of quoting in R... " and ' are for strings, and ` 
(backtick) is for symbols.

On November 7, 2019 6:35:49 AM PST, b...@denney.ws wrote:
>Hi,
>
> 
>
>Short version of the question:  How does one document a method for the
>"("
>class in a .Rd file?
>
> 
>
>Details:
>
>I recently contributed to the digest package functions to assist with
>generating sha1 hashes for formula objects.  Sometimes within formula,
>the
>parenthesis ("(") class is used, for example [1]:
>
> 
>
>> class((a~(b+c))[[3]])
>
>[1] "("
>
> 
>
>So, I wrote a method to handle that class, too.  When trying to
>document it
>in the .Rd file, I tried the following code, but when checking the
>documentation, it gets an error:
>
> 
>
>\method{sha1}{"("}(x, digits = 14, zapsmall = 7, ..., algo = "sha1")
>
> 
>
>The error when checking the documentation is:
>
> 
>
>> checking Rd \usage sections ... WARNING
>
>  Bad \usage lines found in documentation object 'sha1':
>
>   method{sha1}{"("}(x, digits = 14, zapsmall = 7, ...,
>algo = "sha1")
>
>  
>
>  Functions with \usage entries need to have the appropriate \alias
>
>  entries, and all their arguments documented.
>
>  The \usage entries must correspond to syntactically valid R code.
>
>  See chapter 'Writing R documentation files' in the 'Writing R
>
>  Extensions' manual.
>
> 
>
>I have tried variants of escaping the parenthesis like "\(" and "\\("
>and
>the unescaped variant "(", too.
>
> 
>
>Thanks,
>
> 
>
>Bill
>
> 
>
>[1] In case the first thought is, "don't write formula which have a
>full
>side within redundant parentheses", something equivalent to this was
>created
>by update.formula().
>
>
>   [[alternative HTML version deleted]]
>
>__
>R-package-devel@r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-package-devel

-- 
Sent from my phone. Please excuse my brevity.

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] How to Document and S3 Method for the Parenthesis Class?

2019-11-07 Thread bill
Thank you, Duncan, that fixed it!

-Original Message-
From: Duncan Murdoch  
Sent: Thursday, November 7, 2019 10:27 AM
To: b...@denney.ws; r-package-devel@r-project.org
Subject: Re: [R-pkg-devel] How to Document and S3 Method for the Parenthesis 
Class?

On 07/11/2019 9:35 a.m., b...@denney.ws wrote:
> Hi,
> 
>   
> 
> Short version of the question:  How does one document a method for the "("
> class in a .Rd file?
> 
>   
> 
> Details:
> 
> I recently contributed to the digest package functions to assist with 
> generating sha1 hashes for formula objects.  Sometimes within formula, 
> the parenthesis ("(") class is used, for example [1]:
> 
>   
> 
>> class((a~(b+c))[[3]])
> 
> [1] "("
> 
>   
> 
> So, I wrote a method to handle that class, too.  When trying to 
> document it in the .Rd file, I tried the following code, but when 
> checking the documentation, it gets an error:
> 
>   
> 
> \method{sha1}{"("}(x, digits = 14, zapsmall = 7, ..., algo = "sha1")

I think this should work:

   \method{sha1}{`(`}(x, digits = 14, zapsmall = 7, ..., algo = "sha1")

A quick test case gave me errors from not documenting the args, but not the bad 
\usage line error described below.

Duncan Murdoch

> 
>   
> 
> The error when checking the documentation is:
> 
>   
> 
>> checking Rd \usage sections ... WARNING
> 
>Bad \usage lines found in documentation object 'sha1':
> 
>  method{sha1}{"("}(x, digits = 14, zapsmall = 7, 
> ..., algo = "sha1")
> 
>
> 
>Functions with \usage entries need to have the appropriate \alias
> 
>entries, and all their arguments documented.
> 
>The \usage entries must correspond to syntactically valid R code.
> 
>See chapter 'Writing R documentation files' in the 'Writing R
> 
>Extensions' manual.
> 
>   
> 
> I have tried variants of escaping the parenthesis like "\(" and "\\(" 
> and the unescaped variant "(", too.
> 
>   
> 
> Thanks,
> 
>   
> 
> Bill
> 
>   
> 
> [1] In case the first thought is, "don't write formula which have a 
> full side within redundant parentheses", something equivalent to this 
> was created by update.formula().
> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-package-devel@r-project.org mailing list 
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
> 

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] How to Document and S3 Method for the Parenthesis Class?

2019-11-07 Thread bill
That's fair, though it's not 100% consistent because code like the following 
works for symbols, too:

"(\\@" <- 1

(This is selected to show how bad things can be done-- not as an example to 
advocate.)

-Original Message-
From: Jeff Newmiller  
Sent: Thursday, November 7, 2019 10:43 AM
To: r-package-devel@r-project.org; b...@denney.ws
Subject: Re: [R-pkg-devel] How to Document and S3 Method for the Parenthesis 
Class?

There are three types of quoting in R... " and ' are for strings, and ` 
(backtick) is for symbols.

On November 7, 2019 6:35:49 AM PST, b...@denney.ws wrote:
>Hi,
>
> 
>
>Short version of the question:  How does one document a method for the 
>"("
>class in a .Rd file?
>
> 
>
>Details:
>
>I recently contributed to the digest package functions to assist with 
>generating sha1 hashes for formula objects.  Sometimes within formula, 
>the parenthesis ("(") class is used, for example [1]:
>
> 
>
>> class((a~(b+c))[[3]])
>
>[1] "("
>
> 
>
>So, I wrote a method to handle that class, too.  When trying to 
>document it in the .Rd file, I tried the following code, but when 
>checking the documentation, it gets an error:
>
> 
>
>\method{sha1}{"("}(x, digits = 14, zapsmall = 7, ..., algo = "sha1")
>
> 
>
>The error when checking the documentation is:
>
> 
>
>> checking Rd \usage sections ... WARNING
>
>  Bad \usage lines found in documentation object 'sha1':
>
>   method{sha1}{"("}(x, digits = 14, zapsmall = 7, ..., 
>algo = "sha1")
>
>  
>
>  Functions with \usage entries need to have the appropriate \alias
>
>  entries, and all their arguments documented.
>
>  The \usage entries must correspond to syntactically valid R code.
>
>  See chapter 'Writing R documentation files' in the 'Writing R
>
>  Extensions' manual.
>
> 
>
>I have tried variants of escaping the parenthesis like "\(" and "\\("
>and
>the unescaped variant "(", too.
>
> 
>
>Thanks,
>
> 
>
>Bill
>
> 
>
>[1] In case the first thought is, "don't write formula which have a 
>full side within redundant parentheses", something equivalent to this 
>was created by update.formula().
>
>
>   [[alternative HTML version deleted]]
>
>__
>R-package-devel@r-project.org mailing list 
>https://stat.ethz.ch/mailman/listinfo/r-package-devel

--
Sent from my phone. Please excuse my brevity.

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] How to Document and S3 Method for the Parenthesis Class?

2019-11-07 Thread Jeff Newmiller
That works not because of how the language works but because that is how the 
`<-` function works.

On November 7, 2019 7:47:57 AM PST, b...@denney.ws wrote:
>That's fair, though it's not 100% consistent because code like the
>following works for symbols, too:
>
>"(\\@" <- 1
>
>(This is selected to show how bad things can be done-- not as an
>example to advocate.)
>
>-Original Message-
>From: Jeff Newmiller  
>Sent: Thursday, November 7, 2019 10:43 AM
>To: r-package-devel@r-project.org; b...@denney.ws
>Subject: Re: [R-pkg-devel] How to Document and S3 Method for the
>Parenthesis Class?
>
>There are three types of quoting in R... " and ' are for strings, and `
>(backtick) is for symbols.
>
>On November 7, 2019 6:35:49 AM PST, b...@denney.ws wrote:
>>Hi,
>>
>> 
>>
>>Short version of the question:  How does one document a method for the
>
>>"("
>>class in a .Rd file?
>>
>> 
>>
>>Details:
>>
>>I recently contributed to the digest package functions to assist with 
>>generating sha1 hashes for formula objects.  Sometimes within formula,
>
>>the parenthesis ("(") class is used, for example [1]:
>>
>> 
>>
>>> class((a~(b+c))[[3]])
>>
>>[1] "("
>>
>> 
>>
>>So, I wrote a method to handle that class, too.  When trying to 
>>document it in the .Rd file, I tried the following code, but when 
>>checking the documentation, it gets an error:
>>
>> 
>>
>>\method{sha1}{"("}(x, digits = 14, zapsmall = 7, ..., algo = "sha1")
>>
>> 
>>
>>The error when checking the documentation is:
>>
>> 
>>
>>> checking Rd \usage sections ... WARNING
>>
>>  Bad \usage lines found in documentation object 'sha1':
>>
>>   method{sha1}{"("}(x, digits = 14, zapsmall = 7,
>..., 
>>algo = "sha1")
>>
>>  
>>
>>  Functions with \usage entries need to have the appropriate \alias
>>
>>  entries, and all their arguments documented.
>>
>>  The \usage entries must correspond to syntactically valid R code.
>>
>>  See chapter 'Writing R documentation files' in the 'Writing R
>>
>>  Extensions' manual.
>>
>> 
>>
>>I have tried variants of escaping the parenthesis like "\(" and "\\("
>>and
>>the unescaped variant "(", too.
>>
>> 
>>
>>Thanks,
>>
>> 
>>
>>Bill
>>
>> 
>>
>>[1] In case the first thought is, "don't write formula which have a 
>>full side within redundant parentheses", something equivalent to this 
>>was created by update.formula().
>>
>>
>>  [[alternative HTML version deleted]]
>>
>>__
>>R-package-devel@r-project.org mailing list 
>>https://stat.ethz.ch/mailman/listinfo/r-package-devel
>
>--
>Sent from my phone. Please excuse my brevity.

-- 
Sent from my phone. Please excuse my brevity.

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


[R-pkg-devel] Set env variables for cmake

2019-11-07 Thread Sameh M. Abdulah
I am using CMake command inside the configure file to install some dependencies 
for my package. These CMake commands require setting an environment variable. 
When I set it inside the configure file, it does not work!. Thus, I have used 
.Renviron file to set my env variables. This solution works on my machine but 
it does not work with CRAN and I do not know why. What is the best way to set 
environment variables for my configure file?


--Sameh

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel