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))
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
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
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
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
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.
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) {
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,
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
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
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
[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
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.
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
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)
__
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
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,
-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,
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 -
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
[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)
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,
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 =
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 -
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:
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
|
26 matches
Mail list logo