Re: [Rd] R CMD check: Locale not set to C?

2015-02-03 Thread Tobias Setz
I just wanted to share my findings on this topic with you:

Custom variables for checking and building can be set through
~/.R/check.Renviron and  ~/.R/build.Renviron. But not the LANGUAGE
variable; it will always be set to C. I couldn't find a way to change the
locales for a check or build run; they are always set to the locales of my
system (German in my case). Except the collation locale (LC_COLLATE )
which is set to C. That is also what the manual mentions. This should
answer the question in the title.

Therefore I assume that generally the environment variables and the locales
should be set correctly by the package developers within the test (or
vignettes) files. And that it is not possible (or at least intended) to set
a custom language/location environment for build and check runs.


 Dear All
 
 The R CMD check on the zoo (1.7-11) package results in an error on my
 environment. It can be reduced to the following example:
 
 
  require(zoo)
  read.zoo(system.file(doc, demo1.txt, package = zoo), sep = |,
 format=%d %b %Y)
 
 Error in read.zoo(system.file(doc, demo1.txt, package = zoo), sep =
 |,  :
   index has bad entries at data rows: 14 15 16 17 18 19 20
 
 
 I am using the following environment (on Windows 7):
 
 
  sessionInfo()
 R version 3.1.2 (2014-10-31)
 Platform: x86_64-w64-mingw32/x64 (64-bit)
 
 locale:
 [1] LC_COLLATE=German_Switzerland.1252
 LC_CTYPE=German_Switzerland.1252 [3]
 LC_MONETARY=German_Switzerland.1252 LC_NUMERIC=C [5]
 LC_TIME=German_Switzerland.1252
 
 attached base packages:
 [1] stats graphics  grDevices utils datasets  methods   base
 
 
 The problem are the locale settings. In the demo1.txt the months are
 abbreviated in English; while my environment would only accept German
 abbreviations. The problem can be solved by setting the time locale:
 
  Sys.setlocale(LC_TIME, English)
 or
  Sys.setlocale(LC_TIME, C)
 
 
 Now; for R CMD check, the manual
 (http://cran.r-project.org/doc/manuals/r-release/R-exts.html) states the
 following:
 
 - R CMD check and R CMD build run R processes with --vanilla...
 So no possibility to set the locales (in contrary to the environment
 variables) through an Rprofile file...
 
 - All these tests are run with collation set to the C locale...
 If I set LC_ALL or only LC_TIME to C the example shown at the top
 actually works if I run it manually.
 
 
 However; if I run R CMD check I get the ERROR.
 Therefore; are the locales really set to C for R CMD check?
 If yes; why would the example above not work?
 If no; how could I achieve custom locale settings?
 
 Thanks!
 Tobias
 
 
 
 --
 Tobias Setz
 
 Rmetrics Association
 tobias.s...@rmetrics.org
 www.rmetrics.org


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


[Rd] R CMD check: Locale not set to C?

2015-01-22 Thread Tobias Setz
Dear All

The R CMD check on the zoo (1.7-11) package results in an error on my
environment. It can be reduced to the following example:


 require(zoo)
 read.zoo(system.file(doc, demo1.txt, package = zoo), sep = |,
format=%d %b %Y)

Error in read.zoo(system.file(doc, demo1.txt, package = zoo), sep =
|,  :
  index has bad entries at data rows: 14 15 16 17 18 19 20


I am using the following environment (on Windows 7):


 sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=German_Switzerland.1252  LC_CTYPE=German_Switzerland.1252
[3] LC_MONETARY=German_Switzerland.1252 LC_NUMERIC=C
[5] LC_TIME=German_Switzerland.1252

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base


The problem are the locale settings. In the demo1.txt the months are
abbreviated in English; while my environment would only accept German
abbreviations. The problem can be solved by setting the time locale:

 Sys.setlocale(LC_TIME, English)
or
 Sys.setlocale(LC_TIME, C)


Now; for R CMD check, the manual
(http://cran.r-project.org/doc/manuals/r-release/R-exts.html) states the
following:

- R CMD check and R CMD build run R processes with --vanilla...
So no possibility to set the locales (in contrary to the environment
variables) through an Rprofile file...

- All these tests are run with collation set to the C locale...
If I set LC_ALL or only LC_TIME to C the example shown at the top
actually works if I run it manually.


However; if I run R CMD check I get the ERROR.
Therefore; are the locales really set to C for R CMD check?
If yes; why would the example above not work?
If no; how could I achieve custom locale settings?

Thanks!
Tobias



--
Tobias Setz
 
Rmetrics Association
tobias.s...@rmetrics.org
www.rmetrics.org

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


[Rd] no visible global function definition using R-Devel check utility

2014-09-18 Thread Tobias Setz
Hello All

If I check the package fAssets using R-3.1.1 (2014-07-10 under Windows) I
don't get any notes. If I do the same using R-Devel (2014-09-17 r66626 under
Windows) I get the following note:

.
assetsMeanCov: no visible binding for global variable 'scaleTau2'
.

I'll try to explain why with a minimal example. Let's have a look at the
following function:

assetsMeanCov - function(x, method = c(cov, MCD, OGK),  alpha = 1/2,
sigmamu = scaleTau2, ...) {
   if (method == cov) {cov(x, ...)}
   if (method ==  MCD) {robustbase::covMcd(x, alpha = alpha, ...)}
   if (method ==  OGK) {robustbase::covOGK(x, sigmamu =
substitute(sigmamu), ...)}
}

where robustbase is mentioned under Suggests: within the DESCRIPTION file.
This since the function is also usable without having that package
available. R check is now complaining since it cannot find the function
'scaleTau2' defined within the packages namespace or any imported
namespaces. Which is true; since this function is defined within the
robustbase package whose namespace is not imported. Note that:

1) The function works like that if the package is built. No error or warning
if method=OGK is used.
2) By promoting the package robustbase to Imports: within the
DESCRIPTION file and importing that function within the NAMESPACE file the
note would be gone.
3) Using sigmamu = robustbase::scaleTau2 would solve the problem as
well.

I am not very much in favour to import the robustbase package since it is
not necessarily needed. Also I don't know if using the ::  operator within
the functions arguments list is a good concept. Also since the code works
without having that. Therefore I am wondering if this new behaviour within
R-Devel (compared to R-3.1.1) is intentionally and if yes; what would be
best practice for such a setup?

Many thanks for your help and time!!
Tobias

 sessionInfo()
R version 3.1.1 (2014-07-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)

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