[Rd] function to remove attributes?

2007-01-30 Thread Tamas K Papp
Hi, I would like to know if there is a compact way to remove attributes from an object. I know attributes(obj) <- NULL works, but I wonder if there is something similar to unclass or unname. RSiteSearch didn't reveal anything. Thanks, Tamas __ R-dev

Re: [Rd] function to remove attributes?

2007-01-30 Thread Prof Brian D Ripley
On Tue, 30 Jan 2007, Tamas K Papp wrote: > Hi, > > I would like to know if there is a compact way to remove attributes > from an object. I know attributes(obj) <- NULL works, but I wonder if > there is something similar to unclass or unname. RSiteSearch didn't > reveal anything. as.vector is us

[Rd] Speed of for loops

2007-01-30 Thread Tom McCallum
Hi Everyone, I have a question about for loops. If you have something like: f <- function(x) { y <- rep(NA,10); for( i in 1:10 ) { if ( i > 3 ) { if ( is.na(y[i-3]) == FALSE ) { # some calculation F which dep

[Rd] CRAN will be down for 15 minutes

2007-01-30 Thread Stefan Theussl
Dear R Community, Due to maintenance work CRAN will not be available at 30th January around 10 o'clock in the morning CET. Best regards, Stefan Theussl __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

[Rd] R crashes when used from within rpy (PR#9481)

2007-01-30 Thread jgp
Full_Name: Jose Gaetan Pierre Version: 2.4.1 OS: Fedora Core 6 Submission from: (NULL) (196.27.87.14) I have been using R from within rpy for a while because I am more familiar with Python syntax. I first noticed this bug with R-2.4.0. Screendump: -- >>> from rpy impor

Re: [Rd] R crashes when used from within rpy (PR#9481)

2007-01-30 Thread ripley
This is not the address for bug reports on 'rpy'. Your example works in R. On Tue, 30 Jan 2007, [EMAIL PROTECTED] wrote: > Full_Name: Jose Gaetan Pierre > Version: 2.4.1 > OS: Fedora Core 6 > Submission from: (NULL) (196.27.87.14) > > > I have been using R from within rpy for a while because I am

Re: [Rd] R crashes when used from within rpy (PR#9481)

2007-01-30 Thread thomas . friedrichsmeier
--nextPart1830390.4s8xi7h1go Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Tuesday 30 January 2007 06:29, [EMAIL PROTECTED] wrote: > >>> Error during wrapup: C stack usage is too close to the limit Probably the stack-ch

Re: [Rd] Speed of for loops

2007-01-30 Thread Oleg Sklyar
Tom, *apply's generally speed up calculations dramatically. However, if and only if you do a repetitive operation on a vector, list matrix which does NOT require accessing other elements of that variable than the one currently in the *apply index. This means in your case any of *apply will not

Re: [Rd] Speed of for loops

2007-01-30 Thread Tamas K Papp
On Tue, Jan 30, 2007 at 12:15:29PM +, Oleg Sklyar wrote: > magnitude using c-functions for "complex" vector indexing operations. If > you need instructions, I can send you a very nice "Step-by-step guide > for using C/C++ in R" which goes beyond "Writing R Extensions" document. Hi Oleg, Ca

[Rd] Step-by-step guide for using C/C++ in R; WAS: Speed of for loops

2007-01-30 Thread Oleg Sklyar
I know this should not go to [Rd], but the original post was there and the replies as well. Thank you all who expressed interest in the "Step-by-step guide for using C/C++ in R"! Answering some of you, yes it is by me and was written to assist other group members to start adding c/c++ code to

Re: [Rd] Speed of for loops

2007-01-30 Thread Ramon Diaz-Uriarte
On Tuesday 30 January 2007 15:46, Tamas K Papp wrote: > On Tue, Jan 30, 2007 at 12:15:29PM +, Oleg Sklyar wrote: > > magnitude using c-functions for "complex" vector indexing operations. If > > you need instructions, I can send you a very nice "Step-by-step guide > > for using C/C++ in R" which

[Rd] calloc bug in RODBC 1.1-7 and later?

2007-01-30 Thread Earl F. Glynn
I'm trying to load Affy Annotation data from an Access database into R using RODBC. This has worked fine for quite some time. The bug seems to be correlated to RODBC versions 1.1-7 and later. Works fine: R 2.2.0 with RODBC 1.1-4; R 2.3.0 or R 2.4.1 with RODBC 1.1-6 Fails: R 2.3.1 with RDOBC

[Rd] S4 initialize or "generating function"

2007-01-30 Thread Thomas Petzoldt
Hello, apologies if I missed something well known. I'm just revising an own package and wonder if it is still common to use "generating functions" which have the same name as the corresponding S4 class as suggested by Chambers, 2001. "Classes and Methods in the S Language". -- or should one conse

Re: [Rd] "[" operator and indexing ambiguity

2007-01-30 Thread Seth Falcon
Oleg Sklyar <[EMAIL PROTECTED]> writes: > As Tony correctly writes one can generally use nargs() to get the number > of arguments, and this works for "["(x,i,j,...,drop) method as well. The > problem I had with the EBImage where I could not distinguish between > x[index] and x[index,,] is that s

Re: [Rd] Speed of for loops

2007-01-30 Thread Herve Pages
Tom McCallum wrote: > Hi Everyone, > > I have a question about for loops. If you have something like: > > f <- function(x) { > y <- rep(NA,10); > for( i in 1:10 ) { > if ( i > 3 ) { > if ( is.na(y[i-3]) == FALSE ) { >

Re: [Rd] Speed of for loops

2007-01-30 Thread Byron Ellis
Actually, why not use a closure to store previous value(s)? In the simple case, which depends on x_i and y_{i-1} gen.iter = function(x) { y = NA function(i) { y <<- if(is.na(y)) x[i] else y+x[i] } } y = sapply(1:10,gen.iter(x)) Obviously you can modify the function for the bo

Re: [Rd] Speed of for loops

2007-01-30 Thread Byron Ellis
Actually, better yet: gen.iter = function(y=NA) { function(x) { y <<- if(is.na(y)) x else x+y } } sapply(x,gen.iter()) On 1/30/07, Byron Ellis <[EMAIL PROTECTED]> wrote: > Actually, why not use a closure to store previous value(s)? > > In the simple case, which depends on x_i and y_{i-1}

Re: [Rd] Speed of for loops

2007-01-30 Thread Oleg Sklyar
It is surely an elegant way of doing things (although far from being easy to parse visually) but is it really faster than a loop? After all, the indexing problem is the same and sapply simply does the same job as for in this case, plus "<<-" will _search_ through the environment on every single

Re: [Rd] Speed of for loops

2007-01-30 Thread Byron Ellis
IIRC a for loop has more per-iteration overhead that lapply, but the real answer is "it depends on what you're doing exactly." I've seen it be a faster, slower and equal approach. On 1/30/07, Oleg Sklyar <[EMAIL PROTECTED]> wrote: > It is surely an elegant way of doing things (although far from be

Re: [Rd] Speed of for loops

2007-01-30 Thread Herve Pages
Hi, Byron Ellis wrote: > IIRC a for loop has more per-iteration overhead that lapply, but the > real answer is "it depends on what you're doing exactly." I've seen it > be a faster, slower and equal approach. gen.iter = function(y=NA) { function(x) { y <<- if(is.na(y)) x else x+y } } sapply

[Rd] PGF Device

2007-01-30 Thread jtxx000
Greetings all, PGF is a package for LaTeX which works with both ps and pdf output without any nasty hacks like pictex. Is there any technical reason why there could not be a PGF graphic device for R? If not, I'm going to try to throw one together. Any tips for getting started? Cheers, Caleb ___

[Rd] segments and arrows generic?

2007-01-30 Thread Bill.Venables
Has anyone ever suggested making segments() and arrows() generic (as indeed they are in another not dissimilar implementation)? The practical issue with these functions is the need to specify origin and destination using four separate arguments. It would be much more convenient to use only two.