Re: [R-pkg-devel] Fwd: Passing CRAN check when an examples must save a file

2019-09-27 Thread Jeff Newmiller
Read the Posting Guide... sending html formatted email corrupts your message.

Reading between the garbage...

a) Pasting an extension is not necessary.
b) using tempfile() in your example as an argument to sink( file=) is a 
straightforward way to illustrate that a file can be created.

On September 27, 2019 5:16:30 PM PDT, Tiago Olivoto  
wrote:
>Dear all,
>I had the same problem when I submitted my R package 'metan' to CRAN
>for
>the first time.
>
>"Please ensure that your functions do not write by default or in your
>examples/vignettes/tests in the user's home filespace (including the
>package directory and getwd()). In your examples/vignettes/tests you
>can
>write to tempdir()"
>
>I have several 'summary()' functions like:
>
>
>
>
>
>
>
>
>*summary.waasb <- function(object, export = FALSE, file.name
> = "summary_waasb", ...) {  # do all I need here  if
>(export == TRUE) {sink(paste0(file.name ,
>".txt"))
># do all I need heresink()  }}*
>
>All 'export' arguments are set to 'FALSE'. So, no file is generated in
>the
>user's working directory.
>Is the above function not according to the CRAN policies?
>
>In two vignettes I have a code like:
>
>
>
>*```{r, eval=FALSE }summary(stat_ge, export = TRUE)```*
>
>Please, note that 'eval = FALSE'. Could this be the problem?
>The suggestion is to write to a tempdir() but even looking at the
>Duncan
>Murdoch's answer I cannot see how to do that in my case.
>Looking for any suggestion.
>Best regards,
>Tiago Olivoto
>
>
>
>
>
>
>
>
>
>-- Forwarded message -
>De: Duncan Murdoch 
>Date: sex, 27 de set de 2019 às 09:44
>Subject: Re: [R-pkg-devel] Passing CRAN check when an examples must
>save a
>file
>To: Zachary Flynn , 
>
>
>On 26/09/2019 11:43 p.m., Zachary Flynn wrote:
>> I am working on a function in a package that saves a file.  I want to
>write
>> an example to document the function so it must save a file, but when
>I do,
>> the automatic CRAN checks reject the package because there is a
>> non-standard file saved in the directory when the second test runs
>(first,
>> it runs a test on Windows where the check error does not occur, then
>on
>> Linux where it does).  The relevant check output is:
>>
>> * checking for non-standard things in the check directory ... NOTE
>> Found the following files/directories:
>>‘Produc.csv’
>>
>> There is no file called Produc.csv anywhere in the directory (the
>> error doesn't show up in the first run on Windows).
>>
>> It is generated by running the example code which automatic CRAN
>> testing might be doing in between running the Windows and Linux
>> checks?
>>
>> How do I write an example that must save a file to be an example of
>> using the function without triggering this issue?
>
>Save the file to the temporary directory, ẹ.g.
>
>   filename <- file.path(tempdir(), "Prodục.csv")
>   write.csv(something, file = filename)
>
>You could clean up at the end of the example with
>
>   unlink(filename)
>
>but you shouldn't rely on this alone to prevent the error:  if you're
>writing files, you should *only* be doing it in the temporary
>directory.
>
>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

-- 
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] how to throw a C++ exception across modules

2019-09-27 Thread Joshua N Pritikin
OpenMx exports an API that I import into another package (gwsem) like 
this,

  aldp = R_GetCCallable("OpenMx", "AddLoadDataProvider")

gwsem registers some C++ classes through this API.

This works great until gwsem throws a C++ exception. OpenMx calls gwsem in 
a try-catch region. This works flawlessly on Linux. However, it seems to 
not work on Windows. win-builder.r-project.org complained,

** running tests for arch 'i386' ... [23s] ERROR
  Running 'testthat.R' [22s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
  > library(testthat)
  > library(gwsem)
  Loading required package: OpenMx
  > 
  > test_check("gwsem")
  
  This application has requested the Runtime to terminate it in an unusual way.
  Please contact the application's support team for more information.
  terminate called after throwing an instance of 'std::runtime_error'
what():  MxComputeLoadData: out of data (record 250 requested but only 199 
in file)

What solution is recommended?

Thank you.

-- 
Joshua N. Pritikin, Ph.D.
Virginia Institute for Psychiatric and Behavioral Genetics
Virginia Commonwealth University
PO Box 980126
800 E Leigh St, Biotech One, Suite 1-133
Richmond, VA 23219
http://exuberant-island.surge.sh

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


[R-pkg-devel] Fwd: Passing CRAN check when an examples must save a file

2019-09-27 Thread Tiago Olivoto
Dear all,
I had the same problem when I submitted my R package 'metan' to CRAN for
the first time.

"Please ensure that your functions do not write by default or in your
examples/vignettes/tests in the user's home filespace (including the
package directory and getwd()). In your examples/vignettes/tests you can
write to tempdir()"

I have several 'summary()' functions like:








*summary.waasb <- function(object, export = FALSE, file.name
 = "summary_waasb", ...) {  # do all I need here  if
(export == TRUE) {sink(paste0(file.name , ".txt"))
# do all I need heresink()  }}*

All 'export' arguments are set to 'FALSE'. So, no file is generated in the
user's working directory.
Is the above function not according to the CRAN policies?

In two vignettes I have a code like:



*```{r, eval=FALSE }summary(stat_ge, export = TRUE)```*

Please, note that 'eval = FALSE'. Could this be the problem?
The suggestion is to write to a tempdir() but even looking at the Duncan
Murdoch's answer I cannot see how to do that in my case.
Looking for any suggestion.
Best regards,
Tiago Olivoto









-- Forwarded message -
De: Duncan Murdoch 
Date: sex, 27 de set de 2019 às 09:44
Subject: Re: [R-pkg-devel] Passing CRAN check when an examples must save a
file
To: Zachary Flynn , 


On 26/09/2019 11:43 p.m., Zachary Flynn wrote:
> I am working on a function in a package that saves a file.  I want to
write
> an example to document the function so it must save a file, but when I do,
> the automatic CRAN checks reject the package because there is a
> non-standard file saved in the directory when the second test runs (first,
> it runs a test on Windows where the check error does not occur, then on
> Linux where it does).  The relevant check output is:
>
> * checking for non-standard things in the check directory ... NOTE
> Found the following files/directories:
>‘Produc.csv’
>
> There is no file called Produc.csv anywhere in the directory (the
> error doesn't show up in the first run on Windows).
>
> It is generated by running the example code which automatic CRAN
> testing might be doing in between running the Windows and Linux
> checks?
>
> How do I write an example that must save a file to be an example of
> using the function without triggering this issue?

Save the file to the temporary directory, ẹ.g.

   filename <- file.path(tempdir(), "Prodục.csv")
   write.csv(something, file = filename)

You could clean up at the end of the example with

   unlink(filename)

but you shouldn't rely on this alone to prevent the error:  if you're
writing files, you should *only* be doing it in the temporary directory.

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


Re: [R-pkg-devel] Passing CRAN check when an examples must save a file

2019-09-27 Thread Zachary Flynn
Thanks much, that solved the issue,

Zach Flynn


On Fri, Sep 27, 2019, 8:36 AM Duncan Murdoch 
wrote:

> On 26/09/2019 11:43 p.m., Zachary Flynn wrote:
> > I am working on a function in a package that saves a file.  I want to
> write
> > an example to document the function so it must save a file, but when I
> do,
> > the automatic CRAN checks reject the package because there is a
> > non-standard file saved in the directory when the second test runs
> (first,
> > it runs a test on Windows where the check error does not occur, then on
> > Linux where it does).  The relevant check output is:
> >
> > * checking for non-standard things in the check directory ... NOTE
> > Found the following files/directories:
> >‘Produc.csv’
> >
> > There is no file called Produc.csv anywhere in the directory (the
> > error doesn't show up in the first run on Windows).
> >
> > It is generated by running the example code which automatic CRAN
> > testing might be doing in between running the Windows and Linux
> > checks?
> >
> > How do I write an example that must save a file to be an example of
> > using the function without triggering this issue?
>
> Save the file to the temporary directory, ẹ.g.
>
>filename <- file.path(tempdir(), "Prodục.csv")
>write.csv(something, file = filename)
>
> You could clean up at the end of the example with
>
>unlink(filename)
>
> but you shouldn't rely on this alone to prevent the error:  if you're
> writing files, you should *only* be doing it in the temporary directory.
>
> Duncan Murdoch
>

[[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] Passing CRAN check when an examples must save a file

2019-09-27 Thread Duncan Murdoch

On 26/09/2019 11:43 p.m., Zachary Flynn wrote:

I am working on a function in a package that saves a file.  I want to write
an example to document the function so it must save a file, but when I do,
the automatic CRAN checks reject the package because there is a
non-standard file saved in the directory when the second test runs (first,
it runs a test on Windows where the check error does not occur, then on
Linux where it does).  The relevant check output is:

* checking for non-standard things in the check directory ... NOTE
Found the following files/directories:
   ‘Produc.csv’

There is no file called Produc.csv anywhere in the directory (the
error doesn't show up in the first run on Windows).

It is generated by running the example code which automatic CRAN
testing might be doing in between running the Windows and Linux
checks?

How do I write an example that must save a file to be an example of
using the function without triggering this issue?


Save the file to the temporary directory, ẹ.g.

  filename <- file.path(tempdir(), "Prodục.csv")
  write.csv(something, file = filename)

You could clean up at the end of the example with

  unlink(filename)

but you shouldn't rely on this alone to prevent the error:  if you're 
writing files, you should *only* be doing it in the temporary directory.


Duncan Murdoch

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


[R-pkg-devel] Passing CRAN check when an examples must save a file

2019-09-27 Thread Zachary Flynn
I am working on a function in a package that saves a file.  I want to write
an example to document the function so it must save a file, but when I do,
the automatic CRAN checks reject the package because there is a
non-standard file saved in the directory when the second test runs (first,
it runs a test on Windows where the check error does not occur, then on
Linux where it does).  The relevant check output is:

* checking for non-standard things in the check directory ... NOTE
Found the following files/directories:
  ‘Produc.csv’

There is no file called Produc.csv anywhere in the directory (the
error doesn't show up in the first run on Windows).

It is generated by running the example code which automatic CRAN
testing might be doing in between running the Windows and Linux
checks?

How do I write an example that must save a file to be an example of
using the function without triggering this issue?

Zach Flynn

[[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] Package or namespace load failed: undefined symbol

2019-09-27 Thread Ralf Stubner
On Thu, Sep 26, 2019 at 3:41 PM Sameh M. Abdulah
 wrote:
>
> I am installing my dependencies including OpenBLAS during  the package 
> installation via the configure file.
> What is surprising me that even all dependencies are installed successfully. 
> R cannot load one of the library
> that depends on LAPACKE. My method is to install all my dependencies inside 
> the installation directory of my R package and
> set PKG_CONFIG_PATH to this path. Do I need to set any other paths so that R 
> can see my new OpenBLAS which include LAPACKE?

With PKG_CONFIGURE _PATH you enable finding the right compiler flags
for compilation. However, this does not help you with the necessary
run time linking, since you seem to be building dynamic libraries. One
way forward might be:

* Build a static version of LAPACKE
* Build a static version of your dependency
* Build your package linking with your static libs and BLAS/LAPACK as
described in WRE.

cheerio
ralf

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