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",
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
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
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
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
> 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
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
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
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 /
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
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
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
12 matches
Mail list logo