[Rd] Validity glitch when contains="matrix"

2010-05-05 Thread Daniel Murphy
Sirs: My validity function did not run when my class contains="matrix". But if I first define the class with contains="numeric", then define it again with contains="matrix", validity runs. Here's the session: > f <- function(object) "BAD CLASS" # force error to > setClass("A", contains="matrix",

Re: [Rd] R-Forge Problems

2010-05-05 Thread Jari Oksanen
On 5/05/10 20:53 PM, "Gabor Grothendieck" wrote: > If I go to: > > http://r-forge.r-project.org/scm/?group_id=18 > > and click on [Browse Subversion Repository] in the box to the right it > takes me to a page that says this: > > Traceback (most recent call last): File > "/usr/lib/gforge/bin//v

[Rd] R-Forge Problems

2010-05-05 Thread Gabor Grothendieck
If I go to: http://r-forge.r-project.org/scm/?group_id=18 and click on [Browse Subversion Repository] in the box to the right it takes me to a page that says this: Traceback (most recent call last): File "/usr/lib/gforge/bin//viewcvs.cgi", line 27, in import sapi ImportError: No module named sap

[Rd] Simple performance enhancement for ave

2010-05-05 Thread Hadley Wickham
n<-10 grp1<-sample(1:750, n, replace=T) grp2<-sample(1:750, n, replace=T) d<-data.frame(x=rnorm(n), y=rnorm(n), grp1=grp1, grp2=grp2) system.time(ave(d$x, d$grp1, d$grp2, FUN = mean)) # user system elapsed # 19.840 0.125 19.967 system.time(ave(d$x, d$grp1, d$grp2, drop = TRUE, FUN = mean

Re: [Rd] Generate NA of specified type

2010-05-05 Thread Gabor Grothendieck
Try this: replace(x[1][], TRUE, NA) or replace(x[[1]][], TRUE, NA) depending on what you want. On Wed, May 5, 2010 at 11:57 AM, Hadley Wickham wrote: > Hi all, > > Is there an existing function that provides the correct type of > missing value for a given vector? e.g. > > NAof(1:3) # NA_integ

Re: [Rd] Generate NA of specified type

2010-05-05 Thread Hadley Wickham
> What about NAof <- function(x) as(NA, class(x))? > That's pretty close, but it doesn't fail nicely for non-atomics: > as(NA, class(Sys.Date())) Error in as(NA, class(Sys.Date())) : no method or default for coercing "logical" to "Date" vs. > as.Date(NA) [1] NA But I'm probably being too fus

Re: [Rd] Generate NA of specified type

2010-05-05 Thread Roger Peng
What about NAof <- function(x) as(NA, class(x))? -roger On Wed, May 5, 2010 at 11:57 AM, Hadley Wickham wrote: > Hi all, > > Is there an existing function that provides the correct type of > missing value for a given vector? e.g. > > NAof(1:3) # NA_integer_ > NAof(pi) # NA_real_ > NAof("a") # NA

Re: [Rd] Generate NA of specified type

2010-05-05 Thread Tony Plate
I just do as.integer(NA), as.numeric(NA), as.character(NA), etc. -- Tony Plate On 5/5/2010 11:57 AM, Hadley Wickham wrote: Hi all, Is there an existing function that provides the correct type of missing value for a given vector? e.g. NAof(1:3) # NA_integer_ NAof(pi) # NA_real_ NAof("a") # NA_c

[Rd] Generate NA of specified type

2010-05-05 Thread Hadley Wickham
Hi all, Is there an existing function that provides the correct type of missing value for a given vector? e.g. NAof(1:3) # NA_integer_ NAof(pi) # NA_real_ NAof("a") # NA_character_ NAof(T) # NA ? Thanks, Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics /

Re: [Rd] R 2.11.0 on RHEL5

2010-05-05 Thread Uwe Ligges
On 05.05.2010 16:54, Chuck White wrote: Thanks again for your note. I am now compiling using: --with-readline=yes --enable-R-shlib=yes --with-x=yes --with-blas="-llibptf77blas -lpthread -llibatlas" --prefix=/usr/local/R-2.11.0 Yes, that's essentially what I use (except the shlib flags). U

Re: [Rd] R 2.11.0 on RHEL5

2010-05-05 Thread Chuck White
Thanks again for your note. I am now compiling using: --with-readline=yes --enable-R-shlib=yes --with-x=yes --with-blas="-llibptf77blas -lpthread -llibatlas" --prefix=/usr/local/R-2.11.0 The above configuration is creating libRlapack.so as well. Do you specify --with-lapack as well? If so, wha

Re: [Rd] R 2.11.0 on RHEL5

2010-05-05 Thread Uwe Ligges
On 05.05.2010 04:52, Chuck White wrote: Thank you for your response. I did look in the suggested manual under A.3.1.5 Shared BLAS. Here are my steps: compiled R using --with-readline=yes --enable-R-shlib=yes --enable-BLAS-shlib=yes --with-x=yes --prefix=/usr/local/R-2.11.0 Why do you want