Re: [R-pkg-devel] NOTE related to Miniconda installation

2021-09-17 Thread Jeff Newmiller
I can't really see why it should be "recommended" to handle installing system 
requirements inside an R package. There are many ways to satisfy such 
requirements that would not involve miniconda. If you were determined to 
provide such support, doing so in a normal function documented in a vignette 
seems more appropriate.

On September 17, 2021 11:55:07 AM PDT, "Walter, Vonn" 
 wrote:
>Hi Everyone,
>
>I am developing a package (called mypackage in the text below) that uses 
>reticulate to call a Python script for computational efficiency.  At some 
>point during the development of the package I read that it would be good to 
>verify installation of Miniconda.  Thus mypackage includes an onLoad.R file 
>that asks users to either confirm that Miniconda is installed or to proceed 
>with installation on Miniconda.  When I run devtools::check() I get a NOTE 
>related to my onLoad.R file, and this seems to be causing problems when I 
>submit the package to CRAN.  There are no WARNINGs or ERRORs.  Any thoughts 
>would be greatly appreciated.
>
>Thanks,
>
>Vonn
>
>* checking R code for possible problems ... [19s] NOTE
>File 'mypackage/R/onLoad.R':
>  .onLoad calls:
>packageStartupMessage("You should install miniconda before using this 
> package")
>
>See section 'Good practice' in '?.onAttach'.
>
>Here's the code/text from my onLoad.R file:
>
>#' Perform necessary tasks when the mypackage package is loaded
>#'
>#'
>miniconda_installation <- NULL
>miniconda_permission <- NULL
>numpy_import <- NULL
>
>.onLoad <- function(libname, pkgname)
>{
>miniconda_installation <- utils::askYesNo("Is miniconda 
> installed?")
>
>if (isFALSE(miniconda_installation))
>{
>miniconda_permission <- 
> utils::askYesNo("Install miniconda?  Downloads 50MB and takes time.")
>
>if (isTRUE(miniconda_permission))
>{
>reticulate::install_miniconda()
>} else{
>
> packageStartupMessage("You should install miniconda before using this 
> package")
>}
>
>numpy_import <- reticulate::import("numpy", 
> delay_load = TRUE)
>}
>}
>
>
>
>   [[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] NOTE related to Miniconda installation

2021-09-17 Thread Duncan Murdoch

On 17/09/2021 2:55 p.m., Walter, Vonn wrote:

Hi Everyone,

I am developing a package (called mypackage in the text below) that uses 
reticulate to call a Python script for computational efficiency.  At some point 
during the development of the package I read that it would be good to verify 
installation of Miniconda.  Thus mypackage includes an onLoad.R file that asks 
users to either confirm that Miniconda is installed or to proceed with 
installation on Miniconda.  When I run devtools::check() I get a NOTE related 
to my onLoad.R file, and this seems to be causing problems when I submit the 
package to CRAN.  There are no WARNINGs or ERRORs.  Any thoughts would be 
greatly appreciated.



The help page ?.onLoad suggests it should normally be silent.  Users 
might not know which package your message came from, because loading can 
happen indirectly, if some other package they requested imports from 
yours, for instance.


So if you put your startup message on .onAttach, you probably won't get 
the note.


Duncan Murdoch



Thanks,

Vonn

* checking R code for possible problems ... [19s] NOTE
File 'mypackage/R/onLoad.R':
   .onLoad calls:
 packageStartupMessage("You should install miniconda before using this 
package")

See section 'Good practice' in '?.onAttach'.

Here's the code/text from my onLoad.R file:

#' Perform necessary tasks when the mypackage package is loaded
#'
#'
miniconda_installation <- NULL
miniconda_permission <- NULL
numpy_import <- NULL

.onLoad <- function(libname, pkgname)
 {
 miniconda_installation <- utils::askYesNo("Is miniconda 
installed?")

 if (isFALSE(miniconda_installation))
 {
 miniconda_permission <- utils::askYesNo("Install 
miniconda?  Downloads 50MB and takes time.")

 if (isTRUE(miniconda_permission))
 {
 reticulate::install_miniconda()
 } else{
 
packageStartupMessage("You should install miniconda before using this package")
 }

 numpy_import <- reticulate::import("numpy", 
delay_load = TRUE)
 }
 }



[[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


[R-pkg-devel] NOTE related to Miniconda installation

2021-09-17 Thread Walter, Vonn
Hi Everyone,

I am developing a package (called mypackage in the text below) that uses 
reticulate to call a Python script for computational efficiency.  At some point 
during the development of the package I read that it would be good to verify 
installation of Miniconda.  Thus mypackage includes an onLoad.R file that asks 
users to either confirm that Miniconda is installed or to proceed with 
installation on Miniconda.  When I run devtools::check() I get a NOTE related 
to my onLoad.R file, and this seems to be causing problems when I submit the 
package to CRAN.  There are no WARNINGs or ERRORs.  Any thoughts would be 
greatly appreciated.

Thanks,

Vonn

* checking R code for possible problems ... [19s] NOTE
File 'mypackage/R/onLoad.R':
  .onLoad calls:
packageStartupMessage("You should install miniconda before using this 
package")

See section 'Good practice' in '?.onAttach'.

Here's the code/text from my onLoad.R file:

#' Perform necessary tasks when the mypackage package is loaded
#'
#'
miniconda_installation <- NULL
miniconda_permission <- NULL
numpy_import <- NULL

.onLoad <- function(libname, pkgname)
{
miniconda_installation <- utils::askYesNo("Is miniconda 
installed?")

if (isFALSE(miniconda_installation))
{
miniconda_permission <- 
utils::askYesNo("Install miniconda?  Downloads 50MB and takes time.")

if (isTRUE(miniconda_permission))
{
reticulate::install_miniconda()
} else{

packageStartupMessage("You should install miniconda before using this package")
}

numpy_import <- reticulate::import("numpy", 
delay_load = TRUE)
}
}



[[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] Good practice for database with utf-8 string in package

2021-09-17 Thread Maëlle SALMON via R-package-devel
You could also try to submit the package to CRAN with a comment about the NOTE. 
There is interesting information in 
https://discuss.ropensci.org/t/note-on-utf-8-strings-by-goodpractice-gp/2165/

Good luck!

Ma\\u00eblle






Den fredag 17 september 2021 13:01:25 CEST, Enrico Schumann 
 skrev: 





On Fri, 17 Sep 2021, Marc Girondot via R-package-devel writes:

> I have posted this question first to r-h...@r-project.org and Bert Gunter 
> informs me that it was better for this discussion list that I didn't know.
>
> Hello everyone,
>
> I am a little bit stucked on the problem to include a database with
> utf-8 string in a package. When I submit it to CRAN, it reports NOTES
> for several Unix system and I try to find a solution (if it exists) to
> not have these NOTES.
>
> The database has references and some names have non ASCII characters.
>
> * First I don't agree at all with the solution proposed here:
>
> https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Encoding-issues
>
> "First, consider carefully if you really need non-ASCIItext."
>
> If a language has non ASCII characters, it is not just to make the
> writting nicer of more complex, it is because it changes the prononciation.
>
> * Then I try to find solution to not have these NOTES.
>
> For example, here is a reference with utf-8 characters
>
>> DatabaseTSD$Reference[211]
>
> [1] Hernández-Montoya, V., Páez, V.P. & Ceballos, C.P. (2017) Effects of
> temperature on sex determination and embryonic development in the
> red-footed tortoise, Chelonoidis carbonarius. Chelonian Conservation and
> Biology 16, 164-171.
>
> When I convert the characters into unicode, I get indeed only ASCII
> characters. Perfect.
>
>>  iconv(DatabaseTSD$Reference[211], "UTF-8", "ASCII", "Unicode")
>
> [1] "Hernndez-Montoya, V., Pez, V.P. & Ceballos, C.P.
> (2017) Effects of temperature on sex determination and embryonic
> development in the red-footed tortoise, Chelonoidis carbonarius.
> Chelonian Conservation and Biology 16, 164-171."
>
> Then I have no NOTES when I checked the package with database in UNIX...
> but how can I print the reference back with original characters ?
>
> Thanks a lot to point me to best practices to include databases with
> non-ASCII characters and not have NOTES while submitted package to CRAN.
>
> Marc
>

WRE in section 1.1.5 says:

  "Any byte will be allowed in a quoted character string but ‘\u’
    escapes should be used for non-ASCII characters. However, non-ASCII
    character strings may not be usable in some locales and may display
    incorrectly in others."

So you could try to use such escapes, e.g.

    stringi::stri_escape_unicode("Hernández-Montoya")
    ## [1] "Hern\\u00e1ndez-Montoya"


-- 
Enrico Schumann
Lucerne, Switzerland
http://enricoschumann.net


__
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] Good practice for database with utf-8 string in package

2021-09-17 Thread Enrico Schumann
On Fri, 17 Sep 2021, Marc Girondot via R-package-devel writes:

> I have posted this question first to r-h...@r-project.org and Bert Gunter 
> informs me that it was better for this discussion list that I didn't know.
>
> Hello everyone,
>
> I am a little bit stucked on the problem to include a database with
> utf-8 string in a package. When I submit it to CRAN, it reports NOTES
> for several Unix system and I try to find a solution (if it exists) to
> not have these NOTES.
>
> The database has references and some names have non ASCII characters.
>
> * First I don't agree at all with the solution proposed here:
>
> https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Encoding-issues
>
> "First, consider carefully if you really need non-ASCIItext."
>
> If a language has non ASCII characters, it is not just to make the
> writting nicer of more complex, it is because it changes the prononciation.
>
> * Then I try to find solution to not have these NOTES.
>
> For example, here is a reference with utf-8 characters
>
>> DatabaseTSD$Reference[211]
>
> [1] Hernández-Montoya, V., Páez, V.P. & Ceballos, C.P. (2017) Effects of
> temperature on sex determination and embryonic development in the
> red-footed tortoise, Chelonoidis carbonarius. Chelonian Conservation and
> Biology 16, 164-171.
>
> When I convert the characters into unicode, I get indeed only ASCII
> characters. Perfect.
>
>>   iconv(DatabaseTSD$Reference[211], "UTF-8", "ASCII", "Unicode")
>
> [1] "Hernndez-Montoya, V., Pez, V.P. & Ceballos, C.P.
> (2017) Effects of temperature on sex determination and embryonic
> development in the red-footed tortoise, Chelonoidis carbonarius.
> Chelonian Conservation and Biology 16, 164-171."
>
> Then I have no NOTES when I checked the package with database in UNIX...
> but how can I print the reference back with original characters ?
>
> Thanks a lot to point me to best practices to include databases with
> non-ASCII characters and not have NOTES while submitted package to CRAN.
>
> Marc
>

WRE in section 1.1.5 says:

   "Any byte will be allowed in a quoted character string but ‘\u’
escapes should be used for non-ASCII characters. However, non-ASCII
character strings may not be usable in some locales and may display
incorrectly in others."

So you could try to use such escapes, e.g.

stringi::stri_escape_unicode("Hernández-Montoya")
## [1] "Hern\\u00e1ndez-Montoya"


-- 
Enrico Schumann
Lucerne, Switzerland
http://enricoschumann.net

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


[R-pkg-devel] Good practice for database with utf-8 string in package

2021-09-17 Thread Marc Girondot via R-package-devel
I have posted this question first to r-h...@r-project.org and Bert Gunter 
informs me that it was better for this discussion list that I didn't know.

Hello everyone,

I am a little bit stucked on the problem to include a database with
utf-8 string in a package. When I submit it to CRAN, it reports NOTES
for several Unix system and I try to find a solution (if it exists) to
not have these NOTES.

The database has references and some names have non ASCII characters.

* First I don't agree at all with the solution proposed here:

https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Encoding-issues

"First, consider carefully if you really need non-ASCIItext."

If a language has non ASCII characters, it is not just to make the
writting nicer of more complex, it is because it changes the prononciation.

* Then I try to find solution to not have these NOTES.

For example, here is a reference with utf-8 characters

> DatabaseTSD$Reference[211]

[1] Hernández-Montoya, V., Páez, V.P. & Ceballos, C.P. (2017) Effects of
temperature on sex determination and embryonic development in the
red-footed tortoise, Chelonoidis carbonarius. Chelonian Conservation and
Biology 16, 164-171.

When I convert the characters into unicode, I get indeed only ASCII
characters. Perfect.

>   iconv(DatabaseTSD$Reference[211], "UTF-8", "ASCII", "Unicode")

[1] "Hernndez-Montoya, V., Pez, V.P. & Ceballos, C.P.
(2017) Effects of temperature on sex determination and embryonic
development in the red-footed tortoise, Chelonoidis carbonarius.
Chelonian Conservation and Biology 16, 164-171."

Then I have no NOTES when I checked the package with database in UNIX...
but how can I print the reference back with original characters ?

Thanks a lot to point me to best practices to include databases with
non-ASCII characters and not have NOTES while submitted package to CRAN.

Marc


[[alternative HTML version deleted]]

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