Re: [R-pkg-devel] NOTE or Information?

2023-11-28 Thread Enrico Schumann
On Tue, 28 Nov 2023, Göran Broström writes:

> A thirty-year-old format error in the C code of my
> package eha was finally detected by the latest R-devel,
> thanks to CRAN for that!
>
> However, I also get a message never seen before, when I check the package:
>
> ---
> Attaching package: ‘rlang’
>
> The following object is masked from ‘package:base’:
>
> %||%
> ---
>
> I guess that this is a result of my use of devtools and
> roxygen for writing documentation. Is this a bug in
> rlang and the mask part of the message will go away
> when it is fixed?
>
> Thanks, Göran
>

A `%||%` operator has been added to R-devel, and hence
the warning about masking:


https://github.com/r-devel/r-svn/commit/aa23547f2c5a80752194647c811fa2c1433d43b9



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

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


Re: [R-pkg-devel] 2 Return values for 2 Functions

2023-09-26 Thread Enrico Schumann
On Tue, 26 Sep 2023, Leonard Mada via R-package-devel writes:

> Dear Members,
>
>
> How should the return values be documented, when the
> help page covers 2 related functions:
>
>
> 1.) Variant 1: fails the checks
>
> \value{
> \code{cryst1} returns a list of class \sQuote{cryst1} with the
> following components:
> \describe{
> \item{abc}{a numeric vector of length 3 containing the norms of the lattice
>   vectors a, b and c there are more items}
> }
> \item{}{}
> \code{is.cryst1} returns TRUE if \code{x} is an object
> of class \sQuote{cryst1}
>   and FALSE otherwise.
> }
>
>
> 2.) Variant 2: fails in Latex
>
> \value{
> \code{cryst1} returns a list of class \sQuote{cryst1} with the
> following components:
> \describe{
> \item{abc}{a numeric vector of length 3 containing the norms of the lattice
>   vectors a, b and c there are more items}
> }
> \cr\cr
> \code{is.cryst1} returns TRUE if \code{x} is an object
> of class \sQuote{cryst1}
>   and FALSE otherwise.
> }
>
>
> 3.) 2 separate Value-Sections
>
> Did not generate actually 2 sections: only the 1st one.
>
>
> Sincerely,
>
>
> Leonard


Have you tried something like this?

\value{
  Function \code{xx} evaluates to a list:
  \item{A}{result A}
  \item{B}{result B}

  Function \code{yy} evaluates to a list:
  \item{C}{result C}
  \item{D}{result D}  
}

"Writing R Extensions" says not to use \describe environments;
see https://cran.r-project.org/doc/manuals/R-exts.html#index-_005cvalue :

,
| Note that \value is implicitly a \describe environment, so
| that environment should not be used for listing components,
| just individual \item{}{} entries.
`



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

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


Re: [R-pkg-devel] Warning 'as.data.frame.POSIXct()' is deprecated

2023-07-06 Thread Enrico Schumann
On Thu, 06 Jul 2023, Vincent van Hees writes:

> Thanks, in that case the REPLEX for the issue may need to be:
>
>> remember = Sys.getenv("_R_CHECK_AS_DATA_FRAME_EXPLICIT_METHOD_")
>> Sys.setenv("_R_CHECK_AS_DATA_FRAME_EXPLICIT_METHOD_" = TRUE)
>> data.frame(time = Sys.time())
>  time
> 1 2023-07-06 14:29:37
>> data.frame(time = as.POSIXlt(Sys.time()))
>  time
> 1 2023-07-06 14:29:37
> Warning message:
> Direct call of 'as.data.frame.POSIXct()' is deprecated.  Use
> 'as.data.frame.vector()' or 'as.data.frame()' instead
>> Sys.setenv("_R_CHECK_AS_DATA_FRAME_EXPLICIT_METHOD_" = remember)


I think it happens because

data.frame()

calls 'as.data.frame.POSIXlt' (per its S3-class), which
in turn directly calls 'as.data.frame.POSIXct':

## as.data.frame.POSIXlt
function (x, row.names = NULL, optional = FALSE, ...) 
{
value <- as.data.frame.POSIXct(as.POSIXct(x), row.names, 
optional, ...)
if (!optional) 
names(value) <- deparse1(substitute(x))
value
}


Kind regards
Enrico

> Vincent
>
> On Thu, 6 Jul 2023 at 10:41, Tim Taylor 
> wrote:
>
>> Apologies - I've not had enough caffeine just yet. The reprex below
>> highlights the issue but I think the code which implemented the change
>> *may* need tweaking not lapply.
>>
>> Tim
>>
>> On 06/07/2023 09:26, Tim Taylor wrote:
>> > This *may* be an issue in lapply.  Let's see what others day. Reprex
>> > below
>> >
>> > Sys.setenv("_R_CHECK_AS_DATA_FRAME_EXPLICIT_METHOD_" = TRUE)
>> > dat <- Sys.Date()
>> > as.data.frame(dat)
>> > #>  dat
>> > #> 1 2023-07-06
>> > lapply(dat, as.data.frame)
>> > #> Warning: Direct call of 'as.data.frame.Date()' is deprecated.  Use
>> > #> 'as.data.frame.vector()' or 'as.data.frame()' instead
>> > #> [[1]]
>> > #>   X[[i]]
>> > #> 1 2023-07-06
>> >
>> > Tim
>> >
>> > On 06/07/2023 08:54, Vincent van Hees wrote:
>> >> Dear all,
>> >>
>> >> I see the following warning in my package test results:
>> >>
>> >> ```
>> >> Warning
>> >> Direct call of 'as.data.frame.POSIXct()' is deprecated.  Use
>> >> 'as.data.frame.vector()' or 'as.data.frame()' instead
>> >> ```
>> >>
>> >> The warning is not always there and I struggle to make it
>> >> reproducible. I
>> >> have encountered it in both Ubuntu 22.04 and in Windows 11, in both R
>> >> 4.3.0
>> >> and 4.3.1, in both RStudio and in an GitHub Actions environment (example
>> >> <https://github.com/wadpac/GGIR/actions/runs/5463862340/jobs/9945096566>).
>>
>> >>
>> >> The warning gives the impression that I am doing something that R no
>> >> longer
>> >> supports. However, I am not using the command as.data.frame.POSIXct()
>> >> anywhere directly in my code.
>> >>
>> >> When I dive into the code where the warnings occur I see patterns like:
>> >>
>> >> ```
>> >> now = Sys.time()
>> >> df = data.frame (time = seq(now, now + 10, by =1),  B  = 1:11)
>> >> ```
>> >>
>> >> (this is a simplification of for example:
>> >>
>> https://github.com/wadpac/GGIR/blob/master/tests/testthat/test_read.myacc.csv.R
>> >>
>> >> )
>> >>
>> >> Does this mean I am discouraged from putting a vector with POSIXct
>> >> values
>> >> in a data.frame?
>> >> If yes, what would be the recommended work around?
>> >>
>> >> I have been trying to find documentation or online discussions about
>> >> this
>> >> warning but no luck so far. I see R NEWS
>> >> <https://cran.r-project.org/doc/manuals/r-release/NEWS.html> mentions
>> >> updates to POSIXct related objects several times in the past year but
>> >> those
>> >> seem to be different issues.
>> >>
>> >> Best,
>> >>
>> >> Vincent
>> >>
>> >> [[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
>>
>
>   [[alternative HTML version deleted]]
>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel

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

__
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


Re: [R-pkg-devel] speeding up package code/build/test cycle

2021-06-25 Thread Enrico Schumann
On Thu, 24 Jun 2021, Greg Minshall writes:

> hi.
>
> when developing packages, my current work flow is to change the code,
> (re-)build the package, detach/load the package, test (to find the
> N+1'st bug, sigh).
>
> the building step takes tens of seconds.
>
> is there an obvious way to present some code to the R command line and
> have it replace the appropriate function in a given package?
>
> or, are there other things people do to speed up this process?
>
> thanks in advance, Greg
>

I am not sure if it was already mentioned; but if you feel
comfortable with Emacs (I have a hunch you do), then ESS has
functionality that might help:

http://ess.r-project.org/Manual/ess.html#Developing-with-ESS

and in particular

http://ess.r-project.org/Manual/ess.html#Namespaced-Evaluation


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

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


Re: [R-pkg-devel] CRAN check texi2dvi failure

2021-01-09 Thread Enrico Schumann
On Sat, 09 Jan 2021, Paul Gilbert writes:

> I am trying to debug a problem that is appearing in the
> linux and Solaris checks, but not Windows or Mac
> checks, of my package tsfa as reported at
> https://cran.r-project.org/web/checks/check_results_tsfa.html
>
> The problem is with re-building the vignette
>   ...
>   this is package 'tsfa' version '2014.10-1'
>   ...
>  checking re-building of vignette outputs ... [6s/9s] WARNING
>  Error(s) in re-building vignettes:
>   ...
> Running 'texi2dvi' on 'Guide.tex' failed.
> LaTeX errors:
> ! LaTeX Error: \verb ended by end of line.
>   ...
>
> In responding to the threat of removal I have also
> fixes some long standing warnings about adding imports
> to the NAMESPACE. The new version builds with --as-cran
> giving no errors or warnings with both R-devel on
> win-builder (2021-01-07 r79806) and on my linux machine
> (R 2021-01-08 r79812 on Linux Mint 19.3 Tricia). When I
> submit it to CRAN the Windows build is OK but the same
> error happens at the 'texi2dvi' step in the debian
> vignette re-build.
>
> This seems to happens after an example that correctly
> has a warning message (about Heywood cases). In my
> linux build the the warning happens but the message
> does not appear in the pdf output, so one possibility
> is that the handling of the warning on the CRAN Unix
> check machines fails to produce clean tex or suppress
> output. Another possibility is that my build using
> --as-cran is different from the actual CRAN build
> options. For example, my 00check.log shows
> ...
> * checking package vignettes in ‘inst/doc’ ... OK
> * checking re-building of vignette outputs ... OK
> * checking PDF version of manual ... OK
> * checking for non-standard things in the check directory ... OK
> ...
>
> so I am not sure if it uses texi2dvi. (I haven't used
> dvi myself for a long time.)
>
> I'm not sure how to debug this when I can't reproduce
> the error. Suggestions would be appreciated.
>
> Paul Gilbert
>

When I run R CMD check on my Linux machine [*], I also
do not get an error.  But here is a guess: The error
mentions \verb, and the LaTeX manual says that \verb
should be followed by nonspace character.  But in the
vignette it is followed by a space.  Maybe using \url
in the vignette could fix the error?

kind regards
Enrico



[*] R version 4.0.3 (2020-10-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.10



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

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


Re: [R-pkg-devel] How to remove rJava from Ecfun when it's not called directly or indirectly

2020-10-11 Thread Enrico Schumann
On Sat, 10 Oct 2020, Spencer Graves writes:

> Hello, All:
>
>
> "R CMD check Ecfun_0.2-4.tar.gz" fails under
> Windows 10 with "Error: package or namespace load
> failed for 'Ecfun': .onLoad failed in loadNamespace()
> for 'rJava'".
>
>
> However, I cannot find where Ecfun calls rJava.  This is in:
>
>
> https://github.com/sbgraves237/Ecfun
>
>   
> I get nothing from "grep 'rJava'" in the
> DESCRIPTION and NAMESPACE files plus in the man and R
> subdirectories.  I ran tools:package_dependencies
> recursively starting with Ecfun until I got all NULLs
> and could not find rJava anywhere.
>
>
> Thanks,
> Spencer Graves
>
>
> 00install.out
>
>
> * installing *source* package 'Ecfun' ...
> ** using staged installation
> ** R
> ** inst
> ** byte-compile and prepare package for lazy loading
> ** help
> *** installing help indices
> ** building package indices
> ** installing vignettes
> ** testing if installed package can be loaded from temporary location
> *** arch - i386
> Error: package or namespace load failed for 'Ecfun':
>  .onLoad failed in loadNamespace() for 'rJava', details:
>   call: inDL(x, as.logical(local), as.logical(now), ...)
>   error: unable to load shared object 'C:/Program
> Files/R/R-4.0.2/library/rJava/libs/i386/rJava.dll':
>   LoadLibrary failure:  %1 is not a valid Win32 application.
>
> Error: loading failed
> Execution halted
> *** arch - x64
> ERROR: loading failed for 'i386'
> * removing 'C:/Users/spenc/Documents/R/Ecfun/Ecfun.Rcheck/Ecfun'
>
>
> 00check.log
>
>
> * using log directory 'C:/Users/spenc/Documents/R/Ecfun/Ecfun.Rcheck'
> * using R version 4.0.2 (2020-06-22)
> * using platform: x86_64-w64-mingw32 (64-bit)
> * using session charset: ISO8859-1
> * checking for file 'Ecfun/DESCRIPTION' ... OK
> * this is package 'Ecfun' version '0.2-4'
> * checking package namespace information ... OK
> * checking package dependencies ... OK
> * checking if this is a source package ... OK
> * checking if there is a namespace ... OK
> * checking for executable files ... OK
> * checking for hidden files and directories ... OK
> * checking for portable file names ... OK
> * checking whether package 'Ecfun' can be installed ... ERROR
> Installation failed.
> See
> 'C:/Users/spenc/Documents/R/Ecfun/Ecfun.Rcheck/00install.out'
> for details.
> * DONE
> Status: 1 ERROR
>

Hello Spencer

Just a wild guess: the CRAN version of your package
does not list 'xlsx'; but your GitHub version does.
Now, 'xlsx' depends on 'rJava'.  So perhaps start there?

As I said, only a wild guess; but maybe it helps.

Kind regards
Enrico

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

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


Re: [R-pkg-devel] R package which creates a directory in the user home dir

2019-10-17 Thread Enrico Schumann



Quoting Sigbert Klinke :


Hi,

I'am developing a package that circumvents the R package size  
limitation for data sets. For this I store the data set in the  
internet (currently GitHub) and download if it is requested.


To avoid unnecessary downloads and internet connections I create a  
directory in the users home directory to store the data there.  
However, this violates the "CRAN Repository Policy" which says


- Packages should not write in the user’s home filespace (including  
clipboards), nor anywhere else on the file system apart from the R  
session’s temporary directory (or during installation in the  
location pointed to by TMPDIR: and such usage should be cleaned up).


Do I have any chance to get the package to CRAN, if I submit it?

Best Sigbert

--
https://hu.berlin/sk
https://hu.berlin/mmstat3



Hi Sigbert,

there are many packages on CRAN that download data from somewhere
for their users.  They simply ask the user (or rather let the
user specify) if and where to store the data.

kind regards
Enrico

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

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


Re: [R-pkg-devel] duplicate function during build

2016-07-27 Thread Enrico Schumann
rly obvious that I should expect
>>>> issues in this case, but not so clear how to detect the source of the
>>>> problem.
>>>>
>>>> Question: Has anyone created a script to catch such duplicate functions
>>>> from different files during build? I think a warning message that there
>>>> are duplicate functions could save some time and effort. Maybe it's
>>>> already there, but I saw no obvious message. In this case, I'm only
>>>> working in R.
>>>>
>>>> I've found build.R in the R tarball, which is where I suspect such a
>>>> check should go, and I'm willing to prepare a patch when I figure out
>>>> how this should be done. However, it seems worth asking if anyone has
>>>> needed to do this before. I've already done some searching, but the
>>>> results seem to pick up quite different posts than I need.
>>>>
>>>> Cheers, JN
>>>>

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

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


Re: [R-pkg-devel] relation between vignettes and help files

2016-07-13 Thread Enrico Schumann
On Wed, 13 Jul 2016, "Boylan, Ross" <ross.boy...@ucsf.edu> writes:

> I have two questions, one substantive and one technical, about the
> relation between vignettes and help files.  By "help files" I mean the
> regular .Rd files.
>
> Substantively, to what extent should material be duplicated between
> the help files and the vignette?  For example, my vignette includes
> some output summarizing the analysis.  The output has many different
> kinds of information, and the details about what they mean are in the
> help for the function generating the output.  Any advice on how much
> of that information to put in the vignette?.  The vignette could, of
> course, say to see the help for the function for details.
>
> It seems natural to me to have the information in both places, except
> that doing so invites inconsistencies as the code changes, if not
> immediately.
>
> The leads to the the technical question: is there a way to provide
> links to the help from the vignette?  I'm using Sweave.  And,
> similarly, is there a way to reference the vignettes from the help?
> In particular, it seems natural to reference the vignette from the
> package help.
>
> Thanks.
> Ross Boylan


I think this was discussed very recently on R-help:

https://stat.ethz.ch/pipermail/r-help/2016-June/439867.html


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

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