[Rd] as.function()

2008-01-14 Thread Robin Hankin
Hi [this after some considerable thought as to R-help vs R-devel] I want to write a (S3) method for as.function(); toy example follows. Given a matrix a, I need to evaluate trace(ax) as a function of (matrix) x. Here's a trace function: tr - function (a) { i - seq_len(nrow(a))

Re: [Rd] as.function()

2008-01-14 Thread Henrique Dallazuanna
Try this: as.function.foo - function(obj, ...) { newobj - function(x, ...){} body(newobj) - obj return(newobj) } x - expression(2*x + 3*x^2) foo - as.function.foo(x) foo(2) Hope this help On 14/01/2008, Robin Hankin [EMAIL PROTECTED] wrote: Antonio thanks for your help here, but it

Re: [Rd] as.function()

2008-01-14 Thread Prof Brian Ripley
On Mon, 14 Jan 2008, Henrique Dallazuanna wrote: Try this: as.function.foo - function(obj, ...) { newobj - function(x, ...){} body(newobj) - obj return(newobj) } x - expression(2*x + 3*x^2) foo - as.function.foo(x) foo(2) Well, that copies what as.function.polynomial did but that

[Rd] knnFinder package

2008-01-14 Thread Gregoire Pau
Dear all, I have found some serious bugs in the knnFinder package (which supports data structures and algorithms for both exact and approximate nearest neighbor searching in arbitrarily high dimensions) that may trigger segmentation faults. I have fixed them but I had troubles to contact its

[Rd] Possible bug in R 2.6.1 (PR#10565)

2008-01-14 Thread galway
Colleagues, =20 In using the paste command I have to spell out the collapse option: =20 paste(1:3,coll=3Da) [1] 1 a 2 a 3 a paste(1:3,collapse=3Da) [1] 1a2a3 =20 My understanding is that the abbreviation coll should be adequate. Actually, even collaps isn't enough: =20

Re: [Rd] Possible bug in R 2.6.1 (PR#10565)

2008-01-14 Thread ripley
On Fri, 11 Jan 2008, [EMAIL PROTECTED] wrote: Colleagues, =20 In using the paste command I have to spell out the collapse option: =20 paste(1:3,coll=3Da) [1] 1 a 2 a 3 a paste(1:3,collapse=3Da) [1] 1a2a3 =20 My understanding is that the abbreviation coll should be adequate.

Re: [Rd] as.function()

2008-01-14 Thread Duncan Murdoch
Robin Hankin wrote: Hi [this after some considerable thought as to R-help vs R-devel] I want to write a (S3) method for as.function(); toy example follows. Given a matrix a, I need to evaluate trace(ax) as a function of (matrix) x. Here's a trace function: tr - function (a) {

Re: [Rd] as.function()

2008-01-14 Thread Robin Hankin
On 14 Jan 2008, at 10:57, Prof Brian Ripley wrote: On Mon, 14 Jan 2008, Henrique Dallazuanna wrote: Try this: as.function.foo - function(obj, ...) { newobj - function(x, ...){} body(newobj) - obj return(newobj) } x - expression(2*x + 3*x^2) foo - as.function.foo(x) foo(2) Well,

Re: [Rd] as.function()

2008-01-14 Thread Robin Hankin
On 14 Jan 2008, at 11:50, Duncan Murdoch wrote: Robin Hankin wrote: Hi [snip] a - crossprod(matrix(rnorm(12),ncol=3)) class(a) - foo f - as.function(a) # need help to write as.function.foo() x - diag(3) f(x) #should give tr(ax) a - 4 f(x) # should still

Re: [Rd] as.function()

2008-01-14 Thread Prof Brian Ripley
On Mon, 14 Jan 2008, Duncan Murdoch wrote: Robin Hankin wrote: Hi [this after some considerable thought as to R-help vs R-devel] I want to write a (S3) method for as.function(); toy example follows. Given a matrix a, I need to evaluate trace(ax) as a function of (matrix) x. Here's a

Re: [Rd] knnFinder package

2008-01-14 Thread Roger Bivand
On Mon, 14 Jan 2008, Gregoire Pau wrote: Dear all, I have found some serious bugs in the knnFinder package (which supports data structures and algorithms for both exact and approximate nearest neighbor searching in arbitrarily high dimensions) that may trigger segmentation faults. I have

Re: [Rd] Possible bug in R 2.6.1 (PR#10565)

2008-01-14 Thread François Pinard
[Brian Ripley] I do often wonder why people are 'sure you know for certain' (to quote the FAQ) that something as elementary as this would be a bug for so many years. It indicates a lack of respect for the R developers. Not at all. A bug report may be naive, or even wrong, and still be

Re: [Rd] Possible bug in R 2.6.1 (PR#10565)

2008-01-14 Thread Thomas Lumley
On Mon, 14 Jan 2008, [iso-8859-1] François Pinard wrote: [Brian Ripley] I do often wonder why people are 'sure you know for certain' (to quote the FAQ) that something as elementary as this would be a bug for so many years. It indicates a lack of respect for the R developers. Not at all.

Re: [Rd] as.function()

2008-01-14 Thread Gabor Grothendieck
On Jan 14, 2008 6:50 AM, Duncan Murdoch [EMAIL PROTECTED] wrote: Robin Hankin wrote: Hi [this after some considerable thought as to R-help vs R-devel] I want to write a (S3) method for as.function(); toy example follows. Given a matrix a, I need to evaluate trace(ax) as a

[Rd] %s in filename when opening device causes crash (PR#10571)

2008-01-14 Thread richard . cotton
Full_Name: Richard Cotton Version: 2.6.1 OS: Windows XP (32bit) Submission from: (NULL) (193.119.236.82) Using %s in a filename when opening a device causes R to crash, e.g., pdf(foo%s.pdf) win.metafile(foo%s.wmf) postscript(foo%s.ps) __

Re: [Rd] %s in filename when opening device causes crash (PR#10571)

2008-01-14 Thread ripley
On Mon, 14 Jan 2008, [EMAIL PROTECTED] wrote: Full_Name: Richard Cotton Version: 2.6.1 OS: Windows XP (32bit) Submission from: (NULL) (193.119.236.82) Using %s in a filename when opening a device causes R to crash, e.g., pdf(foo%s.pdf) win.metafile(foo%s.wmf) postscript(foo%s.ps) Do

Re: [Rd] %s in filename when opening device causes crash (PR#10571)

2008-01-14 Thread Oleg Sklyar
Same on 2.7.0 Under development (unstable) (2007-12-21 r43753) using Ubuntu i686 2.6.22-14-generic: * ~: R :: R version 2.7.0 Under development (unstable) (2007-12-21 r43753) pdf pdf(foo%s.pdf) *** caught segfault *** address 0x1, cause 'memory not mapped' Traceback: 1: .External(PDF, file,

Re: [Rd] Possible bug in R 2.6.1 (PR#10565)

2008-01-14 Thread Latchezar (Lucho) Dimitrov
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Thomas Lumley Sent: Monday, January 14, 2008 11:24 AM To: François Pinard Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [Rd] Possible bug in R 2.6.1 (PR#10565) On Mon, 14 Jan 2008,

Re: [Rd] as.function()

2008-01-14 Thread Tony Plate
How about this as a version that automatically constructs the argument list (and make into a method for as.function as appropriate)? makefun - function(expr) { f - function() {} body(f) - expr vars - all.vars(expr) if (length(vars)) { args -

Re: [Rd] as.function()

2008-01-14 Thread Gabor Grothendieck
The gsubfn package can do something like that too. If you preface a function with fn$ then it will interpret certain formula arguments as functions. If all we want is the function itself we can use force, the identity function, to recover it: library(gsubfn) fn$force(~ 2*x + 3*y^2) function

Re: [Rd] %s in filename when opening device causes crash (PR#10571)

2008-01-14 Thread Peter Dalgaard
[EMAIL PROTECTED] wrote: On Mon, 14 Jan 2008, [EMAIL PROTECTED] wrote: Full_Name: Richard Cotton Version: 2.6.1 OS: Windows XP (32bit) Submission from: (NULL) (193.119.236.82) Using %s in a filename when opening a device causes R to crash, e.g., pdf(foo%s.pdf)

Re: [Rd] %s in filename when opening device causes crash (PR#10571)

2008-01-14 Thread Prof Brian Ripley
On Mon, 14 Jan 2008, Peter Dalgaard wrote: [EMAIL PROTECTED] wrote: On Mon, 14 Jan 2008, [EMAIL PROTECTED] wrote: Full_Name: Richard Cotton Version: 2.6.1 OS: Windows XP (32bit) Submission from: (NULL) (193.119.236.82) Using %s in a filename when opening a device causes R to crash,

[Rd] illegal data frame produced by [-.data.frame (PR#10574)

2008-01-14 Thread timh
x - data.frame(a=1:3,b=2:4) x[,3] - x Warning message: In `[-.data.frame`(`*tmp*`, , 3, value = list(a = 1:3, b = 2:4)) : provided 2 variables to replace 1 variables x a b a.1 b.1 1 1 2 1 NULL 2 2 3 2 NA 3 3 4 3 NA Warning message: In format.data.frame(x, digits = digits, na.encode =

[Rd] extra space in: all.equal(5,6) (PR#10575)

2008-01-14 Thread timh
all.equal(5,6) [1] Mean relative difference: 0.2 Note the odd extra space. A fix is to change lines in all.equal.numeric from: if (is.na(xy) || xy tolerance) msg - c(msg, paste(Mean, what, if (cplx) Mod, difference:, format(xy))) to: if (cplx) what -

[Rd] rm: failed to get attributes of `/':

2008-01-14 Thread Duncan Murdoch
Recently I have heard reports like the one below a couple of times: Tineke Casneuf wrote: However I did encouter an error when trying to install a self-made dummy package. I am sure it is not due to the package because it can be build on someone else's windows PC. The error message is *rm:

Re: [Rd] Rscript argument processing minor bug with -g

2008-01-14 Thread Dirk Eddelbuettel
On 5 January 2008 at 19:34, Dan Davison wrote: | I think there's a minor bug in the argument-processing carried out by Rscript. | The effect is that if one passes -g as a flag to the script, it is erroneously | exposed to the main executable's argument processing and therefore generates a |