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