Re: [R-pkg-devel] Compile issues on r-devel-linux-x86_64-debian-clang with OpenMP

2024-05-30 Thread Nixon, Michelle Pistner
Hi all,

First off, I want to thank you all for your help! In case it's useful, I was 
able to solve my issue by using Ivan's suggestion from May 23rd.

Best,
Michelle

From: Duncan Murdoch 
Sent: Thursday, May 23, 2024 12:04 PM
To: Dirk Eddelbuettel 
Cc: Nixon, Michelle Pistner ; kurt.hor...@wu.ac.at 
; r-package-devel@r-project.org 

Subject: Re: [R-pkg-devel] Compile issues on r-devel-linux-x86_64-debian-clang 
with OpenMP

[You don't often get email from murdoch.dun...@gmail.com. Learn why this is 
important at https://aka.ms/LearnAboutSenderIdentification ]

On 2024-05-23 11:49 a.m., Dirk Eddelbuettel wrote:
>
> On 22 May 2024 at 14:03, Duncan Murdoch wrote:
> | On 2024-05-22 10:18 a.m., Dirk Eddelbuettel wrote:
> | >
> | > On 22 May 2024 at 13:54, Nixon, Michelle Pistner wrote:
> | > | Thank you both for your responses and help! Kurt-- your message makes a 
> lot of
> | > | sense. I'll try to debug soon and will reach out if I have more 
> questions.
> | >
> | > Interesting.
> | >
> | > Kurt, is there a recommended way to test for this (rare, I may add) case 
> of
> | > 'OpenMP present but usage verboten by R' ?  I do not see an option for 'R 
> CMD
> | > config' jumping out, and there is no pkg-config file either.
> | >
> | > Testing via 'nm' as you show is possible but not exactly 'portable'.  So 
> any
> | > suggestions as to what to condition on here?  Michelle did AFAICT the 
> Right
> | > Thing (TM) by 'borrowing' from the fairly mature check in RcppArmadillo.
> |
> | Not that I know much about writing configure tests, but won't
> | src/include/config.h in the R build dir have "HAVE_OPENMP" defined if
> ^^
> | OpenMP is supported?
>
> I think what Michelle and I are after is for an _installed_ version of R to
> tell us if we can, or cannot, use OpenMP.  Maybe capabilities() needs and 
> extension?

Right, sorry.  I thought that file was distributed, but it's Rconfig.h
that gets installed, and it only has a subset of the definitions.

Duncan


[[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] Help with detritus on temporary directory note

2024-05-30 Thread Duncan Murdoch

On 2024-05-30 7:43 a.m., Ivan Krylov via R-package-devel wrote:

В Thu, 30 May 2024 11:12:05 +0200
Héctor Meleiro Suárez  пишет:


So why is this a problem? Is it that there are too many files aftes
examples and tests are run? or would this NOTE be an issue to CRAN
even if only one file was detected at the end?


This problem has two sides.

The side that R CMD check is giving you NOTEs about is that _examples
and tests_ are requried to keep the global state of the system intact.


Only some parts of the global state:  examples can create variables in 
globalenv().


Duncan Murdoch


This includes all files on the computer: writing anywhere except the
tempdir() is prohibited, and even that must be done with care not to
overwrite anything and cleaned up afterwards.

(See https://cran.r-project.org/web/packages/policies.html and search
for "temporary directory".)

The side that's more subjective is that outside tests and examples,
code shouldn't be touching the filesystem without the user's
permission. Many functions (e.g. write.table()) have a legitimate need
to alter the filesystem. If the user would legitimately benefit from not
having to download the files again (including between R sessions), feel
free to follow the advice of Thierry Onkelinx and use
tools::R_user_dir(...), except in tests and examples.

Testing functions that access external resources over the Internet is
fraught with additional peril. Your examples and tests must not fail if
a download attempt fails, but your users will probably prefer your
functions to stop() with an exception on download failure. One way to
solve this problem is to make sure that the functions that fetch
anything from the Internet raise errors with a specific class set and
then to wrap all examples and tests in tryCatch(...,
yourpackage_Internet_error = function(e) message('Caught an error while
accessing an Internet resource: ', conditionMessage(e))). This way any
other unchecked errors (that your tests attempt to uncover) will still
surface.



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


Re: [R-pkg-devel] Help with detritus on temporary directory note

2024-05-30 Thread Ivan Krylov via R-package-devel
В Thu, 30 May 2024 11:12:05 +0200
Héctor Meleiro Suárez  пишет:

> So why is this a problem? Is it that there are too many files aftes
> examples and tests are run? or would this NOTE be an issue to CRAN
> even if only one file was detected at the end?

This problem has two sides.

The side that R CMD check is giving you NOTEs about is that _examples
and tests_ are requried to keep the global state of the system intact.
This includes all files on the computer: writing anywhere except the
tempdir() is prohibited, and even that must be done with care not to
overwrite anything and cleaned up afterwards.

(See https://cran.r-project.org/web/packages/policies.html and search
for "temporary directory".)

The side that's more subjective is that outside tests and examples,
code shouldn't be touching the filesystem without the user's
permission. Many functions (e.g. write.table()) have a legitimate need
to alter the filesystem. If the user would legitimately benefit from not
having to download the files again (including between R sessions), feel
free to follow the advice of Thierry Onkelinx and use
tools::R_user_dir(...), except in tests and examples.

Testing functions that access external resources over the Internet is
fraught with additional peril. Your examples and tests must not fail if
a download attempt fails, but your users will probably prefer your
functions to stop() with an exception on download failure. One way to
solve this problem is to make sure that the functions that fetch
anything from the Internet raise errors with a specific class set and
then to wrap all examples and tests in tryCatch(...,
yourpackage_Internet_error = function(e) message('Caught an error while
accessing an Internet resource: ', conditionMessage(e))). This way any
other unchecked errors (that your tests attempt to uncover) will still
surface.

-- 
Best regards,
Ivan

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


Re: [R-pkg-devel] Help with detritus on temporary directory note

2024-05-30 Thread Thierry Onkelinx
Dear Hector,

The tmp dir depends on the R session. Use tools::R_user_dir("your_package",
which = "cache") if you want a permanent cache of the files.

Best regards,

ir. Thierry Onkelinx
Statisticus / Statistician

Vlaamse Overheid / Government of Flanders
INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND
FOREST
Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance
thierry.onkel...@inbo.be
Havenlaan 88 bus 73, 1000 Brussel
*Postadres:* Koning Albert II-laan 15 bus 186, 1210 Brussel
*Poststukken die naar dit adres worden gestuurd, worden ingescand en
digitaal aan de geadresseerde bezorgd. Zo kan de Vlaamse overheid haar
dossiers volledig digitaal behandelen. Poststukken met de vermelding
‘vertrouwelijk’ worden niet ingescand, maar ongeopend aan de geadresseerde
bezorgd.*
www.inbo.be

///
To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey
///




Op do 30 mei 2024 om 12:26 schreef Héctor Meleiro Suárez <
hmelei...@gmail.com>:

> Hello everybody. I'm having a problem submitting a package to CRAN. It
> involves a NOTE about  detritus files on the temporary directory.
>
> The thing is my package basically downloads a zip file to the temporary
> directory, unzips, reads and processes some of the extracted files and
> imports the data to the R environment. So after the examples and tests are
> run the temporary directory is full of those files. So I implemented an
> internal cleanup function that removes the download zip file and the
> directory to which the files are extracted and, of course, the NOTE
> disappears. But I really don't like this approach because I want the
> function to keep the files in the temporary directory so that if a file has
> been already downloaded it would not download the file again and just read
> the data.
>
> I thought that R cleaned up the temporary directory when the session ended.
> So why is this a problem? Is it that there are too many files aftes
> examples and tests are run? or would this NOTE be an issue to CRAN even if
> only one file was detected at the end?
>
> Thanks in advance.
>
> This is the NOTE on the logs:
>
> * checking for detritus in the temp directory ... NOTE
> Found the following files/directories:
>   ‘RtmpRfd2nv\02202307_MESA’ ‘RtmpRfd2nv\02202307_MESA.zip’
>   ‘RtmpRfd2nv\02202307_MUNI’ ‘RtmpRfd2nv\02202307_MUNI.zip’
>   ‘RtmpRfd2nv\02202307_TOTA’ ‘RtmpRfd2nv\02202307_TOTA.zip’
>   ‘RtmpRfd2nv\03202307_MUNI’ ‘RtmpRfd2nv\03202307_MUNI.zip’
>   ‘RtmpUEZkAQ\02198210_MUNI’ ‘RtmpUEZkAQ\02198210_MUNI.zip’
>   ‘RtmpUEZkAQ\02201904_MESA’ ‘RtmpUEZkAQ\02201904_MESA.zip’
>   ‘RtmpUEZkAQ\03201911_MUNI’ ‘RtmpUEZkAQ\03201911_MUNI.zip’
>   ‘RtmpVtjuwE\02198210_TOTA’ ‘RtmpVtjuwE\02198210_TOTA.zip’
>   ‘RtmpVtjuwE\02201911_MUNI’ ‘RtmpVtjuwE\02201911_MUNI.zip’
>   ‘RtmpVtjuwE\03200403_MUNI’ ‘RtmpVtjuwE\03200403_MUNI.zip’
>   ‘RtmpcFaNBb\02201512_MUNI’ ‘RtmpcFaNBb\02201512_MUNI.zip’
>   ‘Rtmpe86bkd\02198210_TOTA’ ‘Rtmpe86bkd\02198210_TOTA.zip’
>   ‘Rtmpe86bkd\02201911_MUNI’ ‘Rtmpe86bkd\02201911_MUNI.zip’
>   ‘Rtmpe86bkd\02202307_MESA’ ‘Rtmpe86bkd\02202307_MESA.zip’
>   ‘Rtmpe86bkd\03200403_MUNI’ ‘Rtmpe86bkd\03200403_MUNI.zip’
> * DONE
> Status: 1 NOTE
>
> [[alternative HTML version deleted]]
>
> __
> 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] Help with detritus on temporary directory note

2024-05-30 Thread Héctor Meleiro Suárez
Hello everybody. I'm having a problem submitting a package to CRAN. It
involves a NOTE about  detritus files on the temporary directory.

The thing is my package basically downloads a zip file to the temporary
directory, unzips, reads and processes some of the extracted files and
imports the data to the R environment. So after the examples and tests are
run the temporary directory is full of those files. So I implemented an
internal cleanup function that removes the download zip file and the
directory to which the files are extracted and, of course, the NOTE
disappears. But I really don't like this approach because I want the
function to keep the files in the temporary directory so that if a file has
been already downloaded it would not download the file again and just read
the data.

I thought that R cleaned up the temporary directory when the session ended.
So why is this a problem? Is it that there are too many files aftes
examples and tests are run? or would this NOTE be an issue to CRAN even if
only one file was detected at the end?

Thanks in advance.

This is the NOTE on the logs:

* checking for detritus in the temp directory ... NOTE
Found the following files/directories:
  ‘RtmpRfd2nv\02202307_MESA’ ‘RtmpRfd2nv\02202307_MESA.zip’
  ‘RtmpRfd2nv\02202307_MUNI’ ‘RtmpRfd2nv\02202307_MUNI.zip’
  ‘RtmpRfd2nv\02202307_TOTA’ ‘RtmpRfd2nv\02202307_TOTA.zip’
  ‘RtmpRfd2nv\03202307_MUNI’ ‘RtmpRfd2nv\03202307_MUNI.zip’
  ‘RtmpUEZkAQ\02198210_MUNI’ ‘RtmpUEZkAQ\02198210_MUNI.zip’
  ‘RtmpUEZkAQ\02201904_MESA’ ‘RtmpUEZkAQ\02201904_MESA.zip’
  ‘RtmpUEZkAQ\03201911_MUNI’ ‘RtmpUEZkAQ\03201911_MUNI.zip’
  ‘RtmpVtjuwE\02198210_TOTA’ ‘RtmpVtjuwE\02198210_TOTA.zip’
  ‘RtmpVtjuwE\02201911_MUNI’ ‘RtmpVtjuwE\02201911_MUNI.zip’
  ‘RtmpVtjuwE\03200403_MUNI’ ‘RtmpVtjuwE\03200403_MUNI.zip’
  ‘RtmpcFaNBb\02201512_MUNI’ ‘RtmpcFaNBb\02201512_MUNI.zip’
  ‘Rtmpe86bkd\02198210_TOTA’ ‘Rtmpe86bkd\02198210_TOTA.zip’
  ‘Rtmpe86bkd\02201911_MUNI’ ‘Rtmpe86bkd\02201911_MUNI.zip’
  ‘Rtmpe86bkd\02202307_MESA’ ‘Rtmpe86bkd\02202307_MESA.zip’
  ‘Rtmpe86bkd\03200403_MUNI’ ‘Rtmpe86bkd\03200403_MUNI.zip’
* DONE
Status: 1 NOTE

[[alternative HTML version deleted]]

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