[Rd] seek() and gzfile() on 32-bit R2.12.0 in linux

2010-06-22 Thread Brandon Whitcher
I have installed both 32-bit and 64-bit versions of R2.12.0 (2010-06-15
r52300) on my Ubuntu 10.04 64-bit system.  I observe the following behavior
when running the examples from base::connections.  There appears to be a
problem with seek() on a .gz file when using a 32-bit installation of
R2.12.0, but the problem doesn't appear in the 64-bit installation.  I
realize that seek() has been difficult in the past, and I don't want to open
old wounds, but is this a known problem?  Is this easily fixable?  I have a
package that relies on seek() when accessing gzipped files.

Using the 32-bit installation...

*> zz <- file("ex.data", "w")  # open an output file connection
>  cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file = zz, sep =
"\n")
>  cat("One more line\n", file = zz)
>  close(zz)
> blah = file("ex.data", "r")
> seek(blah)
[1] 0
>
> zz <- gzfile("ex.gz", "w")  # compressed file
>  cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file = zz, sep =
"\n")
>  close(zz)
> blah = file("ex.gz", "r")
> seek(blah)
[1] 7.80707e+17
>
> zz <- bzfile("ex.bz2", "w")  # bzip2-ed file
>  cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file = zz, sep =
"\n")
>  close(zz)
> blah = file("ex.bz2", "r")
> seek(blah)
Error in seek.connection(blah) : 'seek' not enabled for this connection
>*

Using the 64-bit installation...

*> zz <- file("ex.data", "w")  # open an output file connection
> cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file = zz, sep = "\n")
> cat("One more line\n", file = zz)
> close(zz)
> blah = file("ex.data", "r")
> seek(blah)
[1] 0
>
> zz <- gzfile("ex.gz", "w")  # compressed file
> cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file = zz, sep = "\n")
> close(zz)
> blah = file("ex.gz", "r")
> seek(blah)
[1] 0
>
> zz <- bzfile("ex.bz2", "w")  # bzip2-ed file
> cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file = zz, sep = "\n")
> close(zz)
> blah = file("ex.bz2", "r")
> seek(blah)
Error in seek.connection(blah) : 'seek' not enabled for this connection
> *

thanks,

Brandon

[[alternative HTML version deleted]]

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


[Rd] seek() and gzfile() on 32-bit R2.12.0 in linux

2010-06-23 Thread Brandon Whitcher
Peter, thanks for your comments.  The reason I have taken this issue
to R-devel is from the advice of Kurt Hornik.  An update to my package
oro.nifti is being refused by CRAN because it fails on the
_development_ version of R on 32-bit linux.  As we have just discussed
(and thanks to Matt's input), the problem is not with my package but
with the development version of R.  Hence, I wanted to alert to the R
Core Development Team that the _unstable_ version of R appears to have
a problem.

Obviously, I would prefer to have my new version of oro.nifti accepted
by CRAN... but at the moment I am in between a rock and a hard place.
I agree that the 2.12.0 release of R is quite far in the future.  Is
there a possibility of relaxing the exclusion criteria for CRAN?

cheers...

Brandon


Please notice that there is NO release of R 2.12.0 until some time
around October. You are using a build from the UNSTABLE development
branch. The stable branch is 2.11.1 with a release date of May 31. If
Ubuntu is claiming that there is such a thing as a R 2.12.0 release, I'd
say that they  have a problem.

Not that we don't welcome reports on problems in the development branch,
but do notice that it is by definition UNSTABLE, and that bugs can come
and go without notice.

-pd

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


[Rd] R CMD check error in v2.12.0

2010-06-16 Thread Brandon Whitcher
I have received the following error for my package oro.nifti under "CRAN
checks" for r-devel-linux-ix86; i.e.,


http://www.r-project.org/nosvn/R.check/r-devel-linux-ix86/oro.nifti-00check.html

   - using R version 2.12.0 Under development (unstable) (2010-06-12 r52259)

   - using platform: i686-pc-linux-gnu (32-bit)
   - using session charset: UTF-8
   - checking for file ‘oro.nifti/DESCRIPTION’ ... OK
   - this is package ‘oro.nifti’ version ‘0.1.4’
   - checking package name space information ... OK
   - checking package dependencies ... OK
   - checking if this is a source package ... OK
   - checking for executable files ... OK
   - checking whether package ‘oro.nifti’ can be installed ... OK
   - checking package directory ... OK
   - checking for portable file names ... OK
   - checking for sufficient/correct file permissions ... OK
   - checking DESCRIPTION meta-information ... OK
   - checking top-level files ... OK
   - checking index information ... OK
   - checking package subdirectories ... OK
   - checking R files for non-ASCII characters ... OK
   - checking R files for syntax errors ... OK
   - checking whether the package can be loaded ... OK
   - checking whether the package can be loaded with stated dependencies ...
   OK
   - checking whether the package can be unloaded cleanly ... OK
   - checking whether the name space can be loaded with stated dependencies
   ... OK
   - checking whether the name space can be unloaded cleanly ... OK
   - checking for unstated dependencies in R code ... OK
   - checking S3 generic/method consistency ... OK
   - checking replacement functions ... OK
   - checking foreign function calls ... OK
   - checking R code for possible problems ... OK
   - checking Rd files ... OK
   - checking Rd metadata ... OK
   - checking Rd cross-references ... OK
   - checking for missing documentation entries ... OK
   - checking for code/documentation mismatches ... OK
   - checking Rd \usage sections ... OK
   - checking Rd contents ... OK
   - checking examples ... ERROR
   Running examples in ‘oro.nifti-Ex.R’ failed
   The error most likely occurred in:

   > ### Name: writeNIfTI
   > ### Title: writeNIfTI
   > ### Aliases: writeNIfTI
   > ### Keywords: file
   >
   > ### ** Examples
   >
   > norm <- dnorm(seq(-5, 5, length=32), sd=2)
   > norm <- (norm-min(norm)) / max(norm-min(norm))
   > img <- outer(outer(norm, norm), norm)
   > img <- round(255 * img)
   > img[17:32,,] <- 255 - img[17:32,,]
   > img.nifti <- nifti(img) # create NIfTI object
   >
   > writeNIfTI(img.nifti, "test-nifti-image-uint8", verbose=TRUE)
   niftiExtension detected!
   niftiAuditTrail detected!
   vox_offset = 1392
   *writing niftiExtension(s) at byte = 6.803919e+17 # <- LARGE NUMBER!
   writing data at byte = 6.803919e+17 # <- LARGE NUMBER!*
   > ## These files should be viewable in, for example, FSLview
   > ## Make sure you adjust the min/max values for proper visualization
   > data <- readNIfTI("test-nifti-image-uint8", verbose=TRUE)
   fname = test-nifti-image-uint8
   files = test-nifti-image-uint8.nii.gz
   nii = test-nifti-image-uint8.nii.gz
   vox_offset = 1392
   niftiExtension detected!
   Error in read.nifti.content(fname, gzipped = TRUE, verbose = verbose, :
   -- extension size (esize) has overshot voxel offset --
   Calls: readNIfTI -> read.nifti.content
   Execution halted

Please draw your attention to the two lines annotated above.  The line of
code that "looks a bit odd" above is

   cat("  writing niftiExtension(s) at byte =", seek(fid), fill=TRUE)

...where fid is a call to file()... and this large number is causing the
subsequent read function to fail.

My questions are:

   - Why would this error occur in 32-bit linux only for R 2.12.0?
   - How can I test any fixes to this error given I am not running R in
   32-bit linux?

Any suggestions would be welcome.

Thank-you,

Brandon

[[alternative HTML version deleted]]

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