[Rd] invalid alignment error in R-2.4.0

2006-07-11 Thread Robin Hankin
Hi I thought I'd pass one of my package through R CMD check with R-2.4.0 with the following result (it's clean under R-2.3.1): [snip] > > # histogram of the fourth power: > hist(out^4, col="gray") *** caught bus error *** address 0x12, cause 'invalid alignment' Traceback: 1: sort(x, par

[Rd] Documentation: add a bit note (PR#9066)

2006-07-11 Thread feimingchen
Full_Name: Feiming Chen Version: 2.0.0 OS: Unix Submission from: (NULL) (216.52.132.10) Just a note to clarify the document "Writing R Extensions". As a beginner, I was a little confused about this paragraph: Section 1.1.4 Package subdirectories, page 6, the paragraph in the middle: "The 'man

Re: [Rd] invalid alignment error in R-2.4.0

2006-07-11 Thread Martin Maechler
I assume this is specific to your installation of R-devel (R-2.4.0 "unstable"). If I use your 'out', hist(out^4, col = "gray") works just fine consistently. Could it be a compiler / linker mismatch on your Mac? Also, can you run "under the debugger" 'R -d gdb' (from a commandline) ? This

Re: [Rd] Add .git to SCM excludes for build and INSTALL scripts

2006-07-11 Thread Martin Maechler
Thank you Seth, I've committed the changes (BTW: for some reason your patch did not cleanly apply to build.in). Regards, Martin > "Seth" == Seth Falcon <[EMAIL PROTECTED]> > on Mon, 10 Jul 2006 12:02:32 -0700 writes: Seth> Git is a source code management system like CVS, svn, ar

Re: [Rd] invalid alignment error in R-2.4.0

2006-07-11 Thread Robin Hankin
Hi Martin On 11 Jul 2006, at 09:25, Martin Maechler wrote: > I assume this is specific to your installation of R-devel > (R-2.4.0 "unstable"). If I use your 'out', >hist(out^4, col = "gray") > works just fine consistently. > > Could it be a compiler / linker mismatch > on your Mac? Also, c

Re: [Rd] invalid alignment error in R-2.4.0

2006-07-11 Thread Martin Maechler
Hi Robin, thanks for the extra info. I have no clue what the problem might be. But from R-level debugging (and the R traceback you wrote originally), I assume you could trigger the problem already by a simple median(rep(1000, 10)) is that the case? If yes, please follow up on R-devel. In an

Re: [Rd] invalid alignment error in R-2.4.0

2006-07-11 Thread Prof Brian Ripley
On Tue, 11 Jul 2006, Martin Maechler wrote: > Hi Robin, > > thanks for the extra info. I have no clue what the problem > might be. > > But from R-level debugging (and the R traceback you wrote > originally), > I assume you could trigger the problem already by a simple > > median(rep(1000, 10

Re: [Rd] invalid alignment error in R-2.4.0

2006-07-11 Thread Martin Maechler
> "BDR" == Prof Brian Ripley <[EMAIL PROTECTED]> > on Tue, 11 Jul 2006 10:54:15 +0100 (BST) writes: BDR> On Tue, 11 Jul 2006, Martin Maechler wrote: >> Hi Robin, >> >> thanks for the extra info. I have no clue what the problem >> might be. >> >> But from

Re: [Rd] invalid alignment error in R-2.4.0

2006-07-11 Thread Robin Hankin
Hi median(rep(1000,10)) does indeed give a similar error: octopus:~/scratch% ./Rd/R.framework/Versions/2.4/Resources/bin/R -d gdb GNU gdb 6.1-20040303 (Apple version gdb-434) (Wed Nov 2 17:28:16 GMT 2005) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU G

Re: [Rd] often unnecessary duplicate in sapply / as.vector

2006-07-11 Thread Prof Brian Ripley
On Fri, 7 Jul 2006, Thomas Lumley wrote: > On Fri, 7 Jul 2006, Martin Morgan wrote: > > > sapply calls lapply as > > > >answer <- lapply(as.list(X), FUN, ...) > > > > which, when X is a list, causes X to be duplicated unnecessarily. The > > coercion is unnecessary for other mode(X) because in

Re: [Rd] Add .git to SCM excludes for build and INSTALL scripts

2006-07-11 Thread Seth Falcon
Martin Maechler <[EMAIL PROTECTED]> writes: > I've committed the changes > (BTW: for some reason your patch did not cleanly apply to > build.in). Thanks! Sorry about the bad patch, not sure what happened; next time around I will try harder to send something usable. Best, + seth ___

[Rd] Sweave processes comments incorrectly (PR#9073)

2006-07-11 Thread krc
Full_Name: Kevin R. Coombes Version: 2.1.0 OS: Windows XP Submission from: (NULL) (143.111.22.24) I have a source file "devel.Rnw" that uses the LaTeX foils class and ppower4 to produce a PDF presentation file. It starts with a commented note to myself as follows: begin source example

Re: [Rd] often unnecessary duplicate in sapply / as.vector

2006-07-11 Thread Thomas Lumley
On Tue, 11 Jul 2006, Prof Brian Ripley wrote: > On Fri, 7 Jul 2006, Thomas Lumley wrote: > >> On Fri, 7 Jul 2006, Martin Morgan wrote: >> >>> sapply calls lapply as >>> >>>answer <- lapply(as.list(X), FUN, ...) >>> >>> which, when X is a list, causes X to be duplicated unnecessarily. The >>> c

Re: [Rd] often unnecessary duplicate in sapply / as.vector

2006-07-11 Thread Prof Brian Ripley
On Tue, 11 Jul 2006, Thomas Lumley wrote: > On Tue, 11 Jul 2006, Prof Brian Ripley wrote: > > > On Fri, 7 Jul 2006, Thomas Lumley wrote: > > > > > On Fri, 7 Jul 2006, Martin Morgan wrote: > > > > > > > sapply calls lapply as > > > > > > > >answer <- lapply(as.list(X), FUN, ...) > > > > > > >

[Rd] RcppTemplate 4.0 with data frame support

2006-07-11 Thread Dominick Samperi
Data frame support has been added to the package RcppTemplate 4.0, a template/class library that facilitates the use of C++ libraries from R. On the C++ side the code might look something like: RcppFrame frame(fp); // Here fp is the input SEXP corresponding to an R data frame. vector > table = f

Re: [Rd] [R] Date Format

2006-07-11 Thread Martyn Plummer
I moved this to R-devel because I am wondering why the base package does not allow you to convert from numeric to Date. Could we not have something like this? as.Date.numeric <- function(x, epoch="1970-01-01", ...) { if (!is.character(epoch) || length(epoch) != 1) stop("invalid epoch")

Re: [Rd] [R] Date Format

2006-07-11 Thread Peter Dalgaard
Martyn Plummer <[EMAIL PROTECTED]> writes: > I moved this to R-devel because I am wondering why the base package does > not allow you to convert from numeric to Date. Could we not have > something like this? > > as.Date.numeric <- function(x, epoch="1970-01-01", ...) { >if (!is.character(epoc

[Rd] Shared Library Support for AIX?

2006-07-11 Thread Matthew Beason
Fellow R Enthusiasts, I noted on the "R Installation and Administration" page, section C.9 that "--enable-R-shlib" is reported not to work for AIX. Has anyone made any further progress with this as of late? I've successfully compiled R 2.3.1 on AIX 5.2ML7 and AIX 5.3ML3. However, I'd really like t

[Rd] Converting SEXP to primitive C types

2006-07-11 Thread Michael Petrovich
I'm new to R development, so this may be a trivial question. In C, How do you convert a SEXP value returned by an R function to a primitive C type (int, double, char, array, etc.)? I've tried using the INTEGER(x), VECTOR_ELT(x,i), and similar functions found in /src/ include/Rinternals.h, but

Re: [Rd] Converting SEXP to primitive C types

2006-07-11 Thread Prof Brian Ripley
On Tue, 11 Jul 2006, Michael Petrovich wrote: > I'm new to R development, so this may be a trivial question. > > In C, How do you convert a SEXP value returned by an R function to a > primitive C type (int, double, char, array, etc.)? I've tried using > the INTEGER(x), VECTOR_ELT(x,i), and si

Re: [Rd] often unnecessary duplicate in sapply / as.vector

2006-07-11 Thread Prof Brian Ripley
On Tue, 11 Jul 2006, Prof Brian Ripley wrote: > On Fri, 7 Jul 2006, Thomas Lumley wrote: > > On Fri, 7 Jul 2006, Martin Morgan wrote: [...] > > > More generally, perhaps as.vector might not duplicate when mode(x) == > > > mode ? > > > > This isn't a trivial change, because mode(x)==mode does

[Rd] Dropping unused levels of a factor that has "NA" as a level

2006-07-11 Thread J. Hosking
Is this a bug? > f1 <- factor(c("a", NA), levels = c("a", "NA") ) > f2 <- f1[, drop = TRUE] > f2 [1] a Levels: a I would have expected f2 to have only one level, "a". It seems to me that the code in [.factor does not follow the advice in help("factor") on how to set factor co

Re: [Rd] often unnecessary duplicate in sapply / as.vector

2006-07-11 Thread Martin Morgan
This is because RObjToCPtr is not quite careful enough with NAMED, rather than an issue with as.XXX tmp.c: void tmp(double *x) { x[0]=1; return; } > f <- function(x) x > x <- 0 > .C("tmp", f(x), DUP=FALSE) [[1]] [1] 1 > x [1] 1 > x <- 0 > y <- x > .C("tmp", x, DUP=FALSE) [[1]] [1] 1 > y [1] 1

Re: [Rd] often unnecessary duplicate in sapply / as.vector

2006-07-11 Thread Thomas Lumley
On Tue, 11 Jul 2006, Martin Morgan wrote: > This is because RObjToCPtr is not quite careful enough with NAMED, > rather than an issue with as.XXX But DUP=FALSE is documented to be dangerous for this very reason. It never copies, and ?.C makes it clear that .C(,DUP=FALSE) can modify variables th

Re: [Rd] Dropping unused levels of a factor that has "NA" as a level

2006-07-11 Thread Peter Dalgaard
"J. Hosking" <[EMAIL PROTECTED]> writes: > Is this a bug? > >> f1 <- factor(c("a", NA), levels = c("a", "NA") ) >> f2 <- f1[, drop = TRUE] >> f2 >[1] a >Levels: a > > I would have expected f2 to have only one level, "a". It seems > to me that the code in [.factor does n

[Rd] Linux/MacOSX and "X11 protocol error: BadWindow..." warnings

2006-07-11 Thread David Firth
This concerns behaviour which has been noted previously, for example see http://tolstoy.newcastle.edu.au/R/help/05/03/0844.html http://tolstoy.newcastle.edu.au/R/help/03b/6873.html and especially the thread http://tolstoy.newcastle.edu.au/R/help/04/08/3025.html I find that it affects both

Re: [Rd] Dropping unused levels of a factor that has "NA" as a level

2006-07-11 Thread Brahm, David
I mentioned this in R-help on April 28: | as.character.factor contains this line (where cx=levels(x)[x]): | if ("NA" %in% levels(x)) cx[is.na(x)] <- "" | | Is it possible that this is no longer the desired behavior? These | two resu

Re: [Rd] Linux/MacOSX and "X11 protocol error: BadWindow..." warnings

2006-07-11 Thread Peter Dalgaard
David Firth <[EMAIL PROTECTED]> writes: > In an effort to pin it down, outside of Rcmdr or any > packages other than tcltk itself, I came up with a simple > reproducible example. Essentially, the sequence that gives > the warnings is > tktoplevel() > [then close the Tk window using the windo

[Rd] read.spss() cannot import some SPSS files (PR#9074)

2006-07-11 Thread tim . bock
Full_Name: Tim Bock Version: 2.3.1 OS: Windows XP Submission from: (NULL) (220.233.111.181) SPSS v12 on Windows sometimes writes files with a layout_code of 3 instead of the usual layout_code of 2. While I don't know what this signifies, R is able to read these files if I change sfm-read.c to ac