Re: [R-pkg-devel] Using ggplot2 within another package

2021-04-22 Thread Paul SAVARY
Hi Kevin,

I was faced to the same problem and I used 'aes_string()' instead of 'aes()'. 
You can then just write the name of the columns containing the data to plot as 
character strings.

Example:

myPlot <- function(myData, ...) {
# get ready
ggplot(myData, aes_string(x = "myX", y = "myY")) +
   # add my decorations
   theme_bw()
}

It is probably already the case for your function but you need to include #' 
@import ggplot2 in your function preamble (if I am not wrong).

Kind regards
Paul

- Mail original -
De: "Kevin R. Coombes" 
À: "r-package-devel" 
Envoyé: Jeudi 22 Avril 2021 22:28:55
Objet: [R-pkg-devel] Using ggplot2 within another package

Hi,

I'm trying to help clean up an R package for someone else to submit to 
CRAN. He has used ggplot2 to implement a plotting function for the kinds 
of things that his packages generates. His plotting routine basically 
looks like (after changing names to protect the innocent):

myPlot <- fucntion(myData, ...) {
    # get ready
    ggplot(myData, aes(x = myX, y = myY)) +
   # add my decorations
   theme_bw()
}

Of course, "R CMD check --as-cran" complains that there is no global 
binding for "myX" or "myY" since they are columns defined in the 
data.frame "myData".

What is the best way to work around this issue?

Of course, dinosaurs like myself might be tempted to suggest just using 
plain old "plot", so I don't need to see those suggestions.

Do I just ignore the usual ggplot conventions and write "myData$myX" 
inside "aes"  in order to appease the CRAN checker? Or is there some 
tidy-er way to solve this problem?

Thanks,
   Kevin

__
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] Error vignette rebuilding and package imports when re-submitting package

2020-04-15 Thread Paul SAVARY
Hello, 

I'm having trouble re-submitting a package (graph4lg). 

- With r-patched_osx, vignette rebuilding fails with the following message : 

checking re-building of vignette outputs ... [12s/16s] WARNING 
Error(s) in re-building vignettes: 
... 
--- re-building ‘vignette_graph4lg.Rmd’ using rmarkdown 
dyld: lazy symbol binding failed: Symbol not found: chkstk_darwin 
Referenced from: /usr/local/bin/pandoc (which was built for Mac OS X 10.15) 
Expected in: /usr/lib/libSystem.B.dylib 

dyld: Symbol not found: chkstk_darwin 
Referenced from: /usr/local/bin/pandoc (which was built for Mac OS X 10.15) 
Expected in: /usr/lib/libSystem.B.dylib 

Error: processing vignette 'vignette_graph4lg.Rmd' failed with diagnostics: 
pandoc document conversion failed with error 6 
--- failed re-building ‘vignette_graph4lg.Rmd’ 

SUMMARY: processing the following file failed: 
‘vignette_graph4lg.Rmd’ 

Error: Vignette re-building failed. 
Execution halted 

- Besides, although I removed some unused packages from the imports in 
DESCRIPTION file, I still obtain this message : 

checking dependencies in R code ... NOTE 
Namespaces in Imports field not imported from: 
‘Imap’ ‘Rdpack’ ‘ade4’ ‘doBy’ ‘mclust’ 
All declared Imports should be used. 

Except Rdpack which is needed to build the vignette, I removed these packages. 

Finally, although I submit version 0.4.0, I receive checking errors relative to 
version 0.3.0. 

I thank you in advance for your feedbacks. 
Regards 
Paul Savary 







[[alternative HTML version deleted]]

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


[R-pkg-devel] Warning R-hub Windows Server 2008 : qpdf needed

2020-04-22 Thread Paul SAVARY
Hello, 

I'm having trouble checking a package (graph4lg). 

With devtools::check_rhub(), I obtain a warning message on Windows Server 2008 

*checking data fro ASCII and uncompressed saves ... OK 
WARNING 
'qpdf' is needed for checks on size reduction of PDFs 

I checked that qpdf is intalled. It is, because I have Rtools. 
Rtools is in my environment path 

That's the first time I obtain this message, although I checked my package 
several times on Rhub. 
I do not obtain similar messages with other checking platforms. 

I thank you in advance 
Regards 
Paul Savary 


[[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] (SOLVED) Warning R-hub Windows Server 2008 : qpdf needed

2020-04-23 Thread Paul SAVARY
Hi,

Here is the build log showing this warning message: 
https://builder.r-hub.io/status/graph4lg_0.5.0.tar.gz-31e8935d0c724c4b9d6986f31eeff357
 

I have just tried again and this warning message does not show up anymore. I 
thank you Gabor for your help.
(new build log: 
https://builder.r-hub.io/status/graph4lg_0.5.0.tar.gz-6e69d658b38242d0a81efaae5d942be9)

Best regards
Paul

- Mail original -
De: "Gábor Csárdi" 
À: "Paul SAVARY" 
Cc: "r-package-devel" 
Envoyé: Mercredi 22 Avril 2020 18:54:32
Objet: Re: [R-pkg-devel] Warning R-hub Windows Server 2008 : qpdf needed

Hi,

which R version was this? Can you point to a build log?

qpdf is definitely installed on R-hub's Windows machines, and it is
even on the PATH. Maybe the new toolchain did not find it, I have
copied it to a better place now, please try again.

Best,
Gabor

On Wed, Apr 22, 2020 at 5:44 PM Paul SAVARY  wrote:
>
> Hello,
>
> I'm having trouble checking a package (graph4lg).
>
> With devtools::check_rhub(), I obtain a warning message on Windows Server 2008
>
> *checking data fro ASCII and uncompressed saves ... OK
> WARNING
> 'qpdf' is needed for checks on size reduction of PDFs
>
> I checked that qpdf is intalled. It is, because I have Rtools.
> Rtools is in my environment path
>
> That's the first time I obtain this message, although I checked my package 
> several times on Rhub.
> I do not obtain similar messages with other checking platforms.
>
> I thank you in advance
> Regards
> Paul Savary
>
>
> [[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] Making possible the use of external java codes by downloading it

2020-07-03 Thread Paul SAVARY
Hello everyone,

I would like to include external java codes (.jar files) to a package in order 
to speed up some computations.
However, this would increase the package size above 5 Mb and this code would 
not be working for users without java installation. 

Instead, I could include a default parameter in the function calling another R 
package making the same computation but more slowly. It would be best for users 
without java on their computer.
Besides, I could allow users to download the external java code from a stable 
url, and include in the R function all the arguments to launch this java code 
(wrapper for the java code). When downloaded, the jar file should be copied 
directly into the extdata directory in the user computer if possible.

Does it seem feasible to you? 

Many thanks 
Regards
Paul

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


Re: [R-pkg-devel] Proper CRAN way - How to handle dependency of java jar file?

2020-07-13 Thread Paul SAVARY
Thanks you too.

That is also what I am doing. Note that I am downloading jar files into a 
directory created in rappdirs::user_data_dir() using the command 
download.file(url, ...).

If I do not specify 'mode='wb'' in download.file() on a Windows OS, downloaded 
jar file is corrupted and cannot be used because a text file is created in 
which \n are converted into \r\n, which does not make sens for a binary file.

I hope it can help
Cheers

Paul Savary - PhD Student
UMR 6049 ThéMA (Besançon), UMR 6282 Biogéosciences (Dijon), ARP-Astrance 
(Paris) 
Phone number : +33.6.30.97.34.27 
Research topics: population genetics, landscape ecology, graph theory, spatial 
statistics

- Mail original -
De: "Rainer M Krug" 
À: "Maëlle SALMON" 
Cc: "r-package-devel" 
Envoyé: Lundi 13 Juillet 2020 11:15:10
Objet: Re: [R-pkg-devel]  Proper CRAN way - How to handle dependency of java 
jar file?

Thanks Maëlle - that is exactly what I am doing at the moment.

Cheers,

Rainer


> On 13 Jul 2020, at 08:17, Maëlle SALMON  wrote:
> 
> Regarding where to save the jar file, you might be interested in "app dirs" 
> (via tools::R_user_dir() in R from 4.0, the rappdirs package, the hoardr 
> package) cf 
> https://blog.r-hub.io/2020/03/12/user-preferences/#not-so-temporary-files3
> 
> Maëlle.
> 
> Den tisdag 23 juni 2020 14:56:30 CEST, Rainer M Krug  skrev: 
> 
> 
> 
> 
> 
> Thanks Duncan.
> 
>> On 23 Jun 2020, at 14:35, Duncan Murdoch  wrote:
>> 
>> Your assumption that .jar files are not allowed is wrong:  a number of 
>> packages contain them:  rscala, J4R, Rbgs, bartMachine, OpenStreetMap, ...  
>> There's a specific mention about how to include them in the CRAN policy 
>> document:
> 
> That’s good to know.
> 
>> 
>> "For Java .class and .jar files, the sources should be in a top-level java 
>> directory in the source package (or that directory should explain how they 
>> can be obtained)."
> 
> So a tet file in the inst/jar directory giving the link to the GitHub repo 
> would be fine in this case?
> 
>> 
>> If you still decide not to include your .jar file (maybe it is too big, for 
>> example),
> 
> 
> I guess it would be stretching it a bit, as the jar file is 8.2 MB, and 
> plantuml has regular continuous updates, so I would prefer to keep it dynamic.
> 
> 
>> then I think your option 1 is unusable for those people who can't write to 
>> the library location because of permission problems. (Admin privileges are 
>> often necessary to install packages in the main library.)  Generally I think 
>> everyone can install packages somewhere, but users do really get confused 
>> when they have multiple library locations, possibly each containing a 
>> different version of a package.
> 
> So the suggested option would be to have a function, which 
> 1) ask the user to create a directory in the home folder 
> 2) download the jar file into that directory or, when no permission is 
> granted, into the tmpdir()
> 
> Thanks, no major changes necessary for that,
> 
> Rainer
> 
> 
>> 
>> Duncan Murdoch
>> 
>> On 23/06/2020 8:18 a.m., Rainer M Krug wrote:
>>> Hi
>>> I have a package called `plantuml` (https://github.com/rkrug/plantuml) 
>>> which converts plantuml code to UML graphs. It uses for this the java 
>>> program https://plantuml.com which is Open Source.
>>> As it is not allowed to distribute a binary with an R package, I use the 
>>> approach of a function which downloads the jar file into the directory 
>>> `system.file("jar/plantuml.jar", package = "plantuml”)`.
>>> This works nicely, and at the moment, the function is called automatically 
>>> before the plantuml.jar is used.
>>> Now I would like to submit the package to CRAN. I can’t find the guidelines 
>>> anymore, so I am asking here:
>>> What is the appropriate way of handling this?
>>> I can think of a at least two ways of making it obvious to the user, that a 
>>> binary is downloaded:
>>> 1) if the file plantuml.jar is not present, ask the user to run the 
>>> function `updatePlantumlJar()` which downloads the jar to the original 
>>> location in the package directory
>>> 2) tell the user to download the file manually and to put it somewhere, 
>>> where the package will find it
>>> I would prefer the first version, as the plantuml.jar would be in the 
>>> package directory, where usually nobody but the package is doing stuff.
>>> Any suggestions on how I could make this “CRAN conform”?
>>> Thanks a lot,
&g