Re: [R-pkg-devel] Do I need to namespace and import functions from 'methods' package?

2015-07-12 Thread Duncan Murdoch
On 12/07/2015 4:01 PM, Dean Attali wrote:
 I have a package that is using the 'is' function from the 'methods'
 package.  My package has been on CRAN for some time now and has had 3
 different versions already. Yesterday when submitting, I got a response
 with:
 
 * checking R code for possible problems ... NOTE
 ggMarginal: no visible global function definition for 'is'
 Undefined global functions or variables:
   is
 
 
 So I fixed it by changing 'is' to 'methods::is', and then I got a response
 
 * checking dependencies in R code ... WARNING
 '::' or ':::' import not declared from: ‘methods’
 
 
 So I suppose I need to declare 'methods' in my imported packages.
 
 My question is: is this a new requirement, to explicitly import 'methods'
 and namespace functions from it, or has it always been a requirement but I
 just wasn't caught? Or is it not even a requirement and the R CMD check was
 being weird?
 

It is a new requirement.  As Joshua Ulrich posted on Friday,

 Yes, this is expected.  See:
 http://developer.r-project.org/blosxom.cgi/R-devel/NEWS/2015/06/29#n2015-06-29
 
 And an earlier email on this list:
 https://stat.ethz.ch/pipermail/r-package-devel/2015q2/000171.html

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


Re: [R-pkg-devel] Do I need to namespace and import functions from 'methods' package?

2015-07-12 Thread Dean Attali
I see there have been several messages about this recently. I apologize, I
wasn't aware of the fact that I could search old messages on the board -
will do that next time, thanks

---
http://deanattali.com

On 12 July 2015 at 13:36, Duncan Murdoch murdoch.dun...@gmail.com wrote:

 On 12/07/2015 4:01 PM, Dean Attali wrote:
  I have a package that is using the 'is' function from the 'methods'
  package.  My package has been on CRAN for some time now and has had 3
  different versions already. Yesterday when submitting, I got a response
  with:
 
  * checking R code for possible problems ... NOTE
  ggMarginal: no visible global function definition for 'is'
  Undefined global functions or variables:
is
 
 
  So I fixed it by changing 'is' to 'methods::is', and then I got a
 response
 
  * checking dependencies in R code ... WARNING
  '::' or ':::' import not declared from: ‘methods’
 
 
  So I suppose I need to declare 'methods' in my imported packages.
 
  My question is: is this a new requirement, to explicitly import 'methods'
  and namespace functions from it, or has it always been a requirement but
 I
  just wasn't caught? Or is it not even a requirement and the R CMD check
 was
  being weird?
 

 It is a new requirement.  As Joshua Ulrich posted on Friday,

  Yes, this is expected.  See:
 
 http://developer.r-project.org/blosxom.cgi/R-devel/NEWS/2015/06/29#n2015-06-29
 
  And an earlier email on this list:
  https://stat.ethz.ch/pipermail/r-package-devel/2015q2/000171.html




[[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] R-devel problem with temporary files or decompression?

2015-07-12 Thread Henrik Bengtsson
I don't see any particular wrong with your code, so it seems like
R.utils doesn't handle your 'file' / 'tmp' pathnames correctly.
However, I cannot reproduce this (know what 'file' and 'tmp' are would
help), so I cannot fix it either.

Either way, instead of using low-level decompressFile(), you can
achieve what you want with:

rsk - R.utils::gunzip(file, temporary=TRUE, remove=FALSE)

If you don't use temporary=TRUE, then 'rsk' with point to 'sample.rsk'
in the current directory.

/Henrik
(author of R.utils)

On Sun, Jul 12, 2015 at 8:45 AM, Daniel Kelley dan.kel...@dal.ca wrote:
 Uwe, thanks very much. How silly of me.  It was because my code creates full 
 pathnames except if the first char of a filename is “/“ or “~”, etc. I have 
 never really used windows/msdos (went from 1970s unix to OSX) and so I was 
 being very silly. Dan.

 On Jul 12, 2015, at 12:38 PM, Uwe Ligges lig...@statistik.tu-dortmund.de 
 wrote:



 On 12.07.2015 17:33, Daniel Kelley wrote:
 A data file that I’d like to use in my “oce” package is quite large, and 
 compresses well, so I thought of putting a compressed version into 
 inst/extdata. I want my documentation to show how to uncompress the file, 
 partly because these files tend to compress so well that I think users 
 might like to store them in gzipped form.

 Naturally, I want to test my code using R-devel in addition to the 
 ‘release’ version that I have on my box. Since I’ve never been able to get 
 R-devel installed properly on OSX, I thought of submitting to win-builder. 
 I got errors as below my signature line. What I don’t understand is the 
 “Invalid argument”, which seems to be different from the “No such file or 
 directory” that I would expect to get if there were no file. Any ideas on 
 how to proceed?

 Dan Kelley / Oceanography / Dalhousie University / Halifax NS Canada

 ### ** Examples

 library(oce)
 ## A CTD-style rsk
 if (requireNamespace(R.utils)) {
 +   file - system.file(extdata, sample.rsk.gz, package=oce)
 +   tmp - tempfile(fileext=.rsk)
 +   R.utils::decompressFile(file, destname=tmp, ext=gz, FUN=gzfile, 
 remove=FALSE)
 +   rsk - read.rsk(tmp)
 +   ctd - as.ctd(rsk)
 +   plot(ctdTrim(ctd))
 + }
 Loading required namespace: R.utils
 Warning in file(file, r) :
   cannot open file 
 'd:/RCompile/CRANguest/R-devel/oce.Rcheck/examples_i386/D:\temp\RtmpGUYumI\file29ac3bed3fed.rsk':


 Apparently you have put together the location of the current path and the 
 one of the tempfile which does not make sense.

 So very likely a bug in your code. Surprise you do not see it on your end.

 Best,
 Uwe Ligges


 Invalid argument
 Error in file(file, r) : cannot open the connection
 Calls: read.rsk - file
 Execution halted
 ** running examples for arch 'x64' ... ERROR
 __
 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

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


[R-pkg-devel] Do I need to namespace and import functions from 'methods' package?

2015-07-12 Thread Dean Attali
I have a package that is using the 'is' function from the 'methods'
package.  My package has been on CRAN for some time now and has had 3
different versions already. Yesterday when submitting, I got a response
with:

* checking R code for possible problems ... NOTE
 ggMarginal: no visible global function definition for 'is'
 Undefined global functions or variables:
   is


So I fixed it by changing 'is' to 'methods::is', and then I got a response

* checking dependencies in R code ... WARNING
 '::' or ':::' import not declared from: ‘methods’


So I suppose I need to declare 'methods' in my imported packages.

My question is: is this a new requirement, to explicitly import 'methods'
and namespace functions from it, or has it always been a requirement but I
just wasn't caught? Or is it not even a requirement and the R CMD check was
being weird?

---
http://deanattali.com

[[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] R-devel problem with temporary files or decompression?

2015-07-12 Thread Daniel Kelley
Uwe, thanks very much. How silly of me.  It was because my code creates full 
pathnames except if the first char of a filename is “/“ or “~”, etc. I have 
never really used windows/msdos (went from 1970s unix to OSX) and so I was 
being very silly. Dan.

 On Jul 12, 2015, at 12:38 PM, Uwe Ligges lig...@statistik.tu-dortmund.de 
 wrote:
 
 
 
 On 12.07.2015 17:33, Daniel Kelley wrote:
 A data file that I’d like to use in my “oce” package is quite large, and 
 compresses well, so I thought of putting a compressed version into 
 inst/extdata. I want my documentation to show how to uncompress the file, 
 partly because these files tend to compress so well that I think users might 
 like to store them in gzipped form.
 
 Naturally, I want to test my code using R-devel in addition to the ‘release’ 
 version that I have on my box. Since I’ve never been able to get R-devel 
 installed properly on OSX, I thought of submitting to win-builder. I got 
 errors as below my signature line. What I don’t understand is the “Invalid 
 argument”, which seems to be different from the “No such file or directory” 
 that I would expect to get if there were no file. Any ideas on how to 
 proceed?
 
 Dan Kelley / Oceanography / Dalhousie University / Halifax NS Canada
 
 ### ** Examples
 
 library(oce)
 ## A CTD-style rsk
 if (requireNamespace(R.utils)) {
 +   file - system.file(extdata, sample.rsk.gz, package=oce)
 +   tmp - tempfile(fileext=.rsk)
 +   R.utils::decompressFile(file, destname=tmp, ext=gz, FUN=gzfile, 
 remove=FALSE)
 +   rsk - read.rsk(tmp)
 +   ctd - as.ctd(rsk)
 +   plot(ctdTrim(ctd))
 + }
 Loading required namespace: R.utils
 Warning in file(file, r) :
   cannot open file 
 'd:/RCompile/CRANguest/R-devel/oce.Rcheck/examples_i386/D:\temp\RtmpGUYumI\file29ac3bed3fed.rsk':
 
 
 Apparently you have put together the location of the current path and the one 
 of the tempfile which does not make sense.
 
 So very likely a bug in your code. Surprise you do not see it on your end.
 
 Best,
 Uwe Ligges
 
 
 Invalid argument
 Error in file(file, r) : cannot open the connection
 Calls: read.rsk - file
 Execution halted
 ** running examples for arch 'x64' ... ERROR
 __
 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