Re: [Rd] tabulate can accept NA values?
should be in devel now, NAs are ignored (as are non-integers and things outside the nbin argument) Martin Morgan wrote: tabulate has .C("R_tabulate", as.integer(bin), as.integer(length(bin)), as.integer(nbins), ans = integer(nbins), PACKAGE="base")$ans The implementation of R_tabulate has if(x[i] != R_NaInt && x[i] > 0 && x[i] <= *nbin) and so copes with (silently drops) NA. Perhaps the .C could have NAOK=TRUE? This is useful in apply'ing tabulate to the rows or columns of a (large) matrix, where the work-around involves introducing some artificial NA value (and consequently copying the matrix) outside the range of tabulate's nbin argument. Martin -- Robert Gentleman, PhD Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M1-B514 PO Box 19024 Seattle, Washington 98109-1024 206-667-7700 rgent...@fhcrc.org __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Rcmd check fails on Windows Samba network path in R 2.9.1
This error message looks like it comes from src/library/tools/R/install.R, which contains the following test: if (!.file_test("-d", lib) || file.access(lib, 2L)) stop("ERROR: no permission to install to directory ", sQuote(lib), call. = FALSE) The function .file_test() is defined earlier in the same file (it looks at file.info(lib)$isdir) and appears to be intended to be the same as utils:::file_test(). You could start trying to figure out what the problem is by trying these calls on the directory in question from an interactive R session. (They seem to work as intended on my Windows system with a NetApp file system mounted on a letter drive.) -- Tony Plate Kevin R. Coombes wrote: Hi, I have just updated R from version 2.8.1 to version 2.9.1. I am running Windows XP Professional, Service Pack 3. With the update, I decided to update a set of packages that I maintain by compiling them for the new version. Everything worked fine except for one package. This package is unique (among the six I was working on) in that is stored on a UNIX-based file server that is exported to the Windows network via Samba. The root of that network path is mapped to drive "N:" on the local machine. 'Rcmd check' fails for this package under 2.9.1. The error message in '00install.out' is: "Error: ERROR: no permission to install to directory 'N:/krc/Umpire/R-Package/Umpire.Rcheck'" 'Rcmd check' works for this package under 2.8.1. 'Rcmd check' works for this package if the directory is copied onto a local hard drive instead of the network drive. 'Rcmd build' and 'Rcmd build --binary' work under both versions. It would be nice if someone could figure out what has changed and fix it Best, Kevin Coombes __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] bug in seq_along
This has now been fixed in R-2.9 and R-devel by Martin Maechler. Thanks Kasper On Jul 13, 2009, at 15:43 , Hervé Pagès wrote: Hi Kasper and R developers, Kasper Daniel Hansen wrote: Using the IRanges package from Bioconductor and somewhat recent R-2.9.1. ov = IRanges(1:3, 4:6) length(ov) # 3 seq(along = ov) # 1 2 3 as wanted seq_along(ov) # 1! I had expected that the last line would yield 1:3. My guess is that somehow seq_along don't utilize that ov is an S4 class with a length method. I agree, this is not good. seq_along() has always been broken on S4 objects: https://stat.ethz.ch/pipermail/r-devel/2007-July/046337.html so I prefer to not use it, ever. Even when I deal with S3 objects. Because the day I need to extend my code to deal with S4 objects, it's too easy to forget to replace 'seq_along(x)' with 'seq_len(length(x))'. So I'd rather use the latter all the time and from the very beginning (hopefully there is no serious performance penalty for doing this). Surprisingly, seq_along() diserves its own C implementation (why wouldn't seq_along <- function(x) seq_len(length(x)) be just good enough?). It's calling length() at the C level which is an inline function defined as: INLINE_FUN R_len_t length(SEXP s) { int i; switch (TYPEOF(s)) { case NILSXP: return 0; case LGLSXP: case INTSXP: case REALSXP: case CPLXSXP: case STRSXP: case CHARSXP: case VECSXP: case EXPRSXP: case RAWSXP: return LENGTH(s); case LISTSXP: case LANGSXP: case DOTSXP: i = 0; while (s != NULL && s != R_NilValue) { i++; s = CDR(s); } return i; case ENVSXP: return Rf_envlength(s); default: return 1; } } Hence it will return 1 when 's' is an S4SXP. If for whatever reason, seq_along() is not able to figure out what the *real* length of an S4 object is, then wouldn't it be better to make it return an error? Or at least to put a big warning in its man page saying: DON'T TRUST ME ON YOUR S4 OBJECTS, I'M BROKEN! Cheers, H. The last line of the *Details* section of ?seq has a typeo. Currently it is 'seq.int', 'seq_along' and 'seq.int' are primitive: the latter two ignore any argument name. I would guess it ought to be 'seq.int', 'seq_along' and 'seq_len' are primitive: the latter two ignore any argument name. Kasper __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel -- Hervé Pagès Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M2-B876 P.O. Box 19024 Seattle, WA 98109-1024 E-mail: hpa...@fhcrc.org Phone: (206) 667-5791 Fax:(206) 667-1319 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Rcmd check fails on Windows Samba network path in R 2.9.1
Hi, I have just updated R from version 2.8.1 to version 2.9.1. I am running Windows XP Professional, Service Pack 3. With the update, I decided to update a set of packages that I maintain by compiling them for the new version. Everything worked fine except for one package. This package is unique (among the six I was working on) in that is stored on a UNIX-based file server that is exported to the Windows network via Samba. The root of that network path is mapped to drive "N:" on the local machine. 'Rcmd check' fails for this package under 2.9.1. The error message in '00install.out' is: "Error: ERROR: no permission to install to directory 'N:/krc/Umpire/R-Package/Umpire.Rcheck'" 'Rcmd check' works for this package under 2.8.1. 'Rcmd check' works for this package if the directory is copied onto a local hard drive instead of the network drive. 'Rcmd build' and 'Rcmd build --binary' work under both versions. It would be nice if someone could figure out what has changed and fix it Best, Kevin Coombes __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] tabulate can accept NA values?
tabulate has .C("R_tabulate", as.integer(bin), as.integer(length(bin)), as.integer(nbins), ans = integer(nbins), PACKAGE="base")$ans The implementation of R_tabulate has if(x[i] != R_NaInt && x[i] > 0 && x[i] <= *nbin) and so copes with (silently drops) NA. Perhaps the .C could have NAOK=TRUE? This is useful in apply'ing tabulate to the rows or columns of a (large) matrix, where the work-around involves introducing some artificial NA value (and consequently copying the matrix) outside the range of tabulate's nbin argument. Martin -- Martin Morgan Computational Biology / Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: Arnold Building M1 B861 Phone: (206) 667-2793 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] slight inconsistency in ( )
We have a very slight inconsistency in the treatment of logical matrices with our three major factorizations: qr() coerces to numeric , whereas svd() and eigen() give an error. I'm proposing to change svd() and eigen() such that they also treat a logical matrix as if it was 0-1 , analogously to all other arithmetic operations. Martin Maechler, R Core Team & ETH Zurich __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel