Re: [R-pkg-devel] PkgA imports PkgB, and PkgB suggests PkgA?

2023-11-04 Thread Shu Fai Cheung
Many many thanks for the clarification, which is very clear! The case
of testthat is a very good example, as many packages suggest it.

Regards,
Shu Fai


On Sat, Nov 4, 2023 at 4:41 PM Iñaki Ucar  wrote:
>
>
>
> El sáb., 4 nov. 2023 5:43, Shu Fai Cheung  escribió:
>>
>> Hi All,
>>
>> I vaguely recall that, on CRAN, if PkgA imports PkgB, then PkgB cannot
>> import PkgA. (Please correct me if I am wrong.)
>>
>> How about this?
>>
>> PkgA imports PkgB (because PkgA has some helper functions for using PkgB)
>> PkgB suggests PkgA (because some vignettes or examples in PkgB use
>> those helpers from PkgA)
>
>
> Or some tests are based on PkgA, or...
>
>> Is this allowed on CRAN?
>
>
> Yes, it is. For example: testthat imports a bunch of packages to do is thing, 
> and those packages suggest testthat because their test suite is based on it.
>
> Cycles of hard dependencies (Depends, Imports) are not allowed for obvious 
> reasons. But packages should install and work without soft dependencies, so 
> there's no problem there.
>
> Iñaki

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


Re: [R-pkg-devel] [r-package-devel] Win.Metafile and package check - "Found the platform-specific device:"

2023-11-04 Thread Duncan Murdoch

On 04/11/2023 5:35 a.m., wayne.w.jo...@shell.com wrote:

Update:

I noticed in the ggplot2 codebase they also have a call to win.metafile - see 
https://github.com/tidyverse/ggplot2/blob/main/R/save.R#L280-L281

When I use grDevices::win.metafile instead of win.metafile it passes the local 
checks fine.


That sounds like two bugs in the check code:

1.  It complains about win.metafile even though you made its use 
conditional on being on Windows.


2.  It doesn't complain about grDevices::win.metafile.

I don't think you said, but this looks like a NOTE rather than a WARNING 
or ERROR.  I'd use the grDevices::win.metafile for now, but wouldn't be 
surprised if the NOTE turns up again later when #2 gets fixed.


Duncan Murdoch

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


Re: [R-pkg-devel] [r-package-devel] Win.Metafile and package check - "Found the platform-specific device:"

2023-11-04 Thread Wayne.W.Jones
Update:

I noticed in the ggplot2 codebase they also have a call to win.metafile - see 
https://github.com/tidyverse/ggplot2/blob/main/R/save.R#L280-L281

When I use grDevices::win.metafile instead of win.metafile it passes the local 
checks fine.

Wayne

-Original Message-
From: Jones, Wayne R GSUK-PTX/D/S
Sent: 04 November 2023 09:03
To: Vladimir Dergachev 
Cc: r-package-devel@r-project.org
Subject: RE: [R-pkg-devel] [r-package-devel] Win.Metafile and package check - 
"Found the platform-specific device:"

Hi Vladimir,

Thanks for the suggestions. I've considered both but I can't see a way of doing 
what I'm trying to achieve without explicitly adding a call to win.metafile in 
my code.

To explain a little more...

GWSDAT is a Shiny App so we don't use the traditional R graphics device - so 
your suggestion #1 is not an option . Instead, the user is offered a range of 
different plot options in a shiny list box as illustrated here in this windows 
based example:
https://user-images.githubusercontent.com/61183826/280452267-c4287f8d-73cc-42a3-881a-4643bdb31689.png

The list of options presented to the users in the list box is modified 
according to the platform - see code here:  
https://github.com/WayneGitShell/GWSDAT/blob/master/R/server.R#L117-L118

So anyone using a non-windows platform will never be offered the choice of 
"wmf"  to begin with. For example, see the online LINUX  version, 
https://stats-glasgow.shinyapps.io/GWSDATV3-2/.  You will see that this option 
doesn't exist in the list of choices - see 
https://user-images.githubusercontent.com/61183826/280453275-6da9b235-0387-47fd-b3a8-b0a949f0ec3e.png

Any suggestions on how I can modify this approach to make it automatically pass 
the CRAN checks?

Thanks,

Wayne

-Original Message-
From: Vladimir Dergachev 
Sent: 03 November 2023 20:03
To: Jones, Wayne R GSUK-PTX/D/S 
Cc: r-package-devel@r-project.org
Subject: Re: [R-pkg-devel] [r-package-devel] Win.Metafile and package check - 
"Found the platform-specific device:"

Think Secure. This email is from an external source.

On Fri, 3 Nov 2023, wayne.w.jo...@shell.com wrote:

> Dear R-Package-Devel,
>
> As part of GWSDAT package (https://github.com/waynegitshell/GWSDAT) we 
> support the option to output plots to a WMF 
> (https://r-graphics.org/recipe-output-vector-wmf) format if, and only if,  
> the user is on Windows. However, when I run the package checks on here it 
> complains about using a platform specific function with the following message:
>
>  Found the platform-specific device:
>'win.metafile'
>  dev.new() is the preferred way to open a new device, in the unlikely
> event one is needed.
>
> In my opinion this is a false positive - and a similar issue has
> previously been reported here:
> https://stac/
> koverflow.com%2Fquestions%2F70585796%2Funable-to-understand-1-note-in-
> devtoolscheck-caused-by-a-platform-specific-d=05%7C01%7CWayne.W.J
> ones%40shell.com%7C991ba83bef5648af7e8408dbdca7deea%7Cdb1e96a8a3da442a
> 930b235cac24cd5c%7C0%7C0%7C638346385789331058%7CUnknown%7CTWFpbGZsb3d8
> eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3
> 000%7C%7C%7C=FLTuWH3yJq0sK%2FePWzv5ga%2FcXQGvHNmQOauw3x5RTXc%3D&
> reserved=0
>
> Any ideas on how I modify the code and package submission to automatically 
> pass the checks?

Two suggestions:

   * let users specify the graphics device they want

   * reading manpage for dev.new() it accepts a bunch of options - there is 
probably a way to request the metafile device you want. But I could not find 
that in documentation.

best

Vladimir Dergachev

>
> Thanks,
>
> Wayne
>
>
>
> --
> --
> Wayne Jones
> Principal Data Scientist
> Decarbonisation Data Science
>
> Tel: +44 (0) 207 934 4330
> Projects and Technology, Shell Research Limited, Shell Centre, York
> Road, London, SE1 7NA
> Email: wayne.w.jo...@shell.com
> Intranet:
> Shell.ai 2F%2Feu001-sp.shell.com%2Fsites%2FAAFAA6690%2FShell.ai%2Fhomepage.aspx
> =05%7C01%7CWayne.W.Jones%40shell.com%7C991ba83bef5648af7e8408dbdc
> a7deea%7Cdb1e96a8a3da442a930b235cac24cd5c%7C0%7C0%7C638346385789331058
> %7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6I
> k1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C=z9EBpBRKRttm2r5hJkEol54xSA
> 6hp76CTjZVvahYoso%3D=0>
> Internet:
> http://www.s/
> hell.ai%2F=05%7C01%7CWayne.W.Jones%40shell.com%7C991ba83bef5648af
> 7e8408dbdca7deea%7Cdb1e96a8a3da442a930b235cac24cd5c%7C0%7C0%7C63834638
> 5789331058%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzI
> iLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C=zaHgal1ZfA5%2B0l
> FhpJoq2FEEJb1d5kQrogu9%2FLQt3Po%3D=0 protection.outlook.com/?url=http%3A%2F%2Fwww.shell.ai%2F=05%7C01%
> 7CWayne.W.Jones%40shell.com%7C991ba83bef5648af7e8408dbdca7deea%7Cdb1e9
> 

Re: [R-pkg-devel] [r-package-devel] Win.Metafile and package check - "Found the platform-specific device:"

2023-11-04 Thread Wayne.W.Jones
Hi Vladimir,

Thanks for the suggestions. I've considered both but I can't see a way of doing 
what I'm trying to achieve without explicitly adding a call to win.metafile in 
my code.

To explain a little more...

GWSDAT is a Shiny App so we don't use the traditional R graphics device - so 
your suggestion #1 is not an option . Instead, the user is offered a range of 
different plot options in a shiny list box as illustrated here in this windows 
based example:
https://user-images.githubusercontent.com/61183826/280452267-c4287f8d-73cc-42a3-881a-4643bdb31689.png

The list of options presented to the users in the list box is modified 
according to the platform - see code here:  
https://github.com/WayneGitShell/GWSDAT/blob/master/R/server.R#L117-L118

So anyone using a non-windows platform will never be offered the choice of 
"wmf"  to begin with. For example, see the online LINUX  version, 
https://stats-glasgow.shinyapps.io/GWSDATV3-2/.  You will see that this option 
doesn't exist in the list of choices - see 
https://user-images.githubusercontent.com/61183826/280453275-6da9b235-0387-47fd-b3a8-b0a949f0ec3e.png

Any suggestions on how I can modify this approach to make it automatically pass 
the CRAN checks?

Thanks,

Wayne

-Original Message-
From: Vladimir Dergachev 
Sent: 03 November 2023 20:03
To: Jones, Wayne R GSUK-PTX/D/S 
Cc: r-package-devel@r-project.org
Subject: Re: [R-pkg-devel] [r-package-devel] Win.Metafile and package check - 
"Found the platform-specific device:"

Think Secure. This email is from an external source.

On Fri, 3 Nov 2023, wayne.w.jo...@shell.com wrote:

> Dear R-Package-Devel,
>
> As part of GWSDAT package (https://github.com/waynegitshell/GWSDAT) we 
> support the option to output plots to a WMF 
> (https://r-graphics.org/recipe-output-vector-wmf) format if, and only if,  
> the user is on Windows. However, when I run the package checks on here it 
> complains about using a platform specific function with the following message:
>
>  Found the platform-specific device:
>'win.metafile'
>  dev.new() is the preferred way to open a new device, in the unlikely
> event one is needed.
>
> In my opinion this is a false positive - and a similar issue has
> previously been reported here:
> https://stac/
> koverflow.com%2Fquestions%2F70585796%2Funable-to-understand-1-note-in-
> devtoolscheck-caused-by-a-platform-specific-d=05%7C01%7CWayne.W.J
> ones%40shell.com%7C991ba83bef5648af7e8408dbdca7deea%7Cdb1e96a8a3da442a
> 930b235cac24cd5c%7C0%7C0%7C638346385789331058%7CUnknown%7CTWFpbGZsb3d8
> eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3
> 000%7C%7C%7C=FLTuWH3yJq0sK%2FePWzv5ga%2FcXQGvHNmQOauw3x5RTXc%3D&
> reserved=0
>
> Any ideas on how I modify the code and package submission to automatically 
> pass the checks?

Two suggestions:

   * let users specify the graphics device they want

   * reading manpage for dev.new() it accepts a bunch of options - there is 
probably a way to request the metafile device you want. But I could not find 
that in documentation.

best

Vladimir Dergachev

>
> Thanks,
>
> Wayne
>
>
>
> --
> --
> Wayne Jones
> Principal Data Scientist
> Decarbonisation Data Science
>
> Tel: +44 (0) 207 934 4330
> Projects and Technology, Shell Research Limited, Shell Centre, York
> Road, London, SE1 7NA
> Email: wayne.w.jo...@shell.com
> Intranet:
> Shell.ai 2F%2Feu001-sp.shell.com%2Fsites%2FAAFAA6690%2FShell.ai%2Fhomepage.aspx
> =05%7C01%7CWayne.W.Jones%40shell.com%7C991ba83bef5648af7e8408dbdc
> a7deea%7Cdb1e96a8a3da442a930b235cac24cd5c%7C0%7C0%7C638346385789331058
> %7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6I
> k1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C=z9EBpBRKRttm2r5hJkEol54xSA
> 6hp76CTjZVvahYoso%3D=0>
> Internet:
> http://www.s/
> hell.ai%2F=05%7C01%7CWayne.W.Jones%40shell.com%7C991ba83bef5648af
> 7e8408dbdca7deea%7Cdb1e96a8a3da442a930b235cac24cd5c%7C0%7C0%7C63834638
> 5789331058%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzI
> iLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C=zaHgal1ZfA5%2B0l
> FhpJoq2FEEJb1d5kQrogu9%2FLQt3Po%3D=0 protection.outlook.com/?url=http%3A%2F%2Fwww.shell.ai%2F=05%7C01%
> 7CWayne.W.Jones%40shell.com%7C991ba83bef5648af7e8408dbdca7deea%7Cdb1e9
> 6a8a3da442a930b235cac24cd5c%7C0%7C0%7C638346385789331058%7CUnknown%7CT
> WFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI
> 6Mn0%3D%7C3000%7C%7C%7C=zaHgal1ZfA5%2B0lFhpJoq2FEEJb1d5kQrogu9%2
> FLQt3Po%3D=0>
>
>
>   [[alternative HTML version deleted]]
>
> __
> R-package-devel@r-project.org mailing list
> https://stat/
> 

Re: [R-pkg-devel] PkgA imports PkgB, and PkgB suggests PkgA?

2023-11-04 Thread Iñaki Ucar
El sáb., 4 nov. 2023 5:43, Shu Fai Cheung 
escribió:

> Hi All,
>
> I vaguely recall that, on CRAN, if PkgA imports PkgB, then PkgB cannot
> import PkgA. (Please correct me if I am wrong.)
>
> How about this?
>
> PkgA imports PkgB (because PkgA has some helper functions for using PkgB)
> PkgB suggests PkgA (because some vignettes or examples in PkgB use
> those helpers from PkgA)
>

Or some tests are based on PkgA, or...

Is this allowed on CRAN?
>

Yes, it is. For example: testthat imports a bunch of packages to do is
thing, and those packages suggest testthat because their test suite is
based on it.

Cycles of hard dependencies (Depends, Imports) are not allowed for obvious
reasons. But packages should install and work without soft dependencies, so
there's no problem there.

Iñaki

[[alternative HTML version deleted]]

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