[Rd] question about ... passed to two different functions

2009-09-06 Thread Charles Geyer
I have hit a problem with the design of the mcmc package I can't figure out, possibly because I don't really understand the R function call mechanism. The function metrop in the mcmc package has a ... argument that it passes to one or two user-supplied functions, which are other arguments to

Re: [Rd] question about ... passed to two different functions

2009-09-06 Thread Duncan Murdoch
On 06/09/2009 1:50 PM, Charles Geyer wrote: I have hit a problem with the design of the mcmc package I can't figure out, possibly because I don't really understand the R function call mechanism. The function metrop in the mcmc package has a ... argument that it passes to one or two

[Rd] question about try and errors

2009-07-15 Thread Kasper Daniel Hansen
I am using try. I have found that sometimes errors are not caught by try. For example, I got the following error message from code that was wrapped in try. After the error, my R CMD BATCH aborted. Error in assign(.target, met...@target, envir = envir) : no function to return from, jumping

[Rd] question on row.names attribute of dataframe when called from a compiled package

2009-03-17 Thread Whit Armstrong
Why does the following show a class attribute of character when using the interpreter: x - data.frame(hat=1:10) class(rownames(x)) ## returns [1] character but when called from c/cpp, the rownames attribute has no class attribute, and is in fact a vector of INTSXP?

Re: [Rd] question on row.names attribute of dataframe when called from a compiled package

2009-03-17 Thread Simon Urbanek
On Mar 17, 2009, at 16:45 , Whit Armstrong wrote: Why does the following show a class attribute of character when using the interpreter: x - data.frame(hat=1:10) class(rownames(x)) ## returns [1] character but when called from c/cpp, the rownames attribute has no class attribute Note

Re: [Rd] question

2009-03-08 Thread Wacek Kusnierczyk
ivo...@gmail.com wrote: Gentlemen---these are all very clever workarounds, but please forgive me for voicing my own opinion: IMHO, returning multiple values in a statistical language should really be part of the language itself. there should be a standard syntax of some sort, whatever it

Re: [Rd] question

2009-03-07 Thread Wacek Kusnierczyk
mark.braving...@csiro.au wrote: The syntax for returning multiple arguments does not strike me as particularly appealing. would it not possible to allow syntax like: f= function() { return( rnorm(10), rnorm(20) ) } (a,d$b) = f() FWIW, my own solution is to define a

Re: [Rd] question

2009-03-07 Thread Gabor Grothendieck
Why? Can you demonstrate any situations where its useful? Despite having my own facility for this I've found that over the years I have never used it. On Sat, Mar 7, 2009 at 9:23 AM, ivo...@gmail.com wrote: Gentlemen---these are all very clever workarounds, but please forgive me for voicing

Re: [Rd] question

2009-03-07 Thread ivowel
Gentlemen---these are all very clever workarounds, but please forgive me for voicing my own opinion: IMHO, returning multiple values in a statistical language should really be part of the language itself. there should be a standard syntax of some sort, whatever it may be, that everyone

Re: [Rd] question

2009-03-07 Thread ivo welch
hi gabor: this would be difficult to do. I don't think you want to read my programs. it would give you an appreciation of what ugly horror programs end users can write in the beautiful R language ;-). clearly, one can work around the lack of such a feature. multiple-return values are syntax

Re: [Rd] question

2009-03-07 Thread Gabor Grothendieck
On Sat, Mar 7, 2009 at 9:38 AM, ivo welch ivo...@gmail.com wrote: hi gabor:  this would be difficult to do.  I don't think you want to read my programs.  it would give you an appreciation of what ugly horror programs end users can write in the beautiful R language  ;-). clearly, one can work

Re: [Rd] question

2009-03-07 Thread Wacek Kusnierczyk
ivo...@gmail.com wrote: Gentlemen---these are all very clever workarounds, hacks around the lack of a feature but please forgive me for voicing my own opinion: IMHO, returning multiple values in a statistical language should really be part of the language itself. returning multiple values

Re: [Rd] question

2009-03-07 Thread Gabor Grothendieck
On Sat, Mar 7, 2009 at 10:26 AM, Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no wrote: ivo...@gmail.com wrote: Gentlemen---these are all very clever workarounds, hacks around the lack of a feature but please forgive me for voicing my own opinion: IMHO, returning multiple values in

Re: [Rd] question

2009-03-07 Thread Wacek Kusnierczyk
Gabor Grothendieck wrote: On Sat, Mar 7, 2009 at 9:38 AM, ivo welch ivo...@gmail.com wrote: hi gabor: this would be difficult to do. I don't think you want to read my programs. it would give you an appreciation of what ugly horror programs end users can write in the beautiful R language

Re: [Rd] question

2009-03-07 Thread Wacek Kusnierczyk
Gabor Grothendieck wrote: as gabor says in another post, you probably should first show why having multiple value returns would be useful in r. however, i don't think there are good counterarguments anyway, and putting on you the burden of proving a relatively obvious (or not so?) thing is a

Re: [Rd] question

2009-03-07 Thread Gabor Grothendieck
On Sat, Mar 7, 2009 at 11:37 AM, Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no wrote: Gabor Grothendieck wrote: as gabor says in another post, you probably should first show why having multiple value returns would be useful in r.  however, i don't think there are good

Re: [Rd] question

2009-03-07 Thread Patrick Burns
One idea of program design is that users should be protected against themselves. It is my experience that users, especially novices, tend to over-split items rather than over-clump items. The fact that items are returned by the same function call would argue to me that there is a connection

Re: [Rd] question

2009-03-07 Thread Thomas Petzoldt
Patrick Burns wrote: One idea of program design is that users should be protected against themselves. It is my experience that users, especially novices, tend to over-split items rather than over-clump items. The fact that items are returned by the same function call would argue to me that

Re: [Rd] question

2009-03-07 Thread Wacek Kusnierczyk
Gabor Grothendieck wrote: I've provided an argument against it and no one has provided one for it. The so-called identical code Ivo showed was not identical and, in fact, was flawed. no, you're wrong. you think of the part where ivo shows what he'd like to have; the example i was

Re: [Rd] question

2009-03-07 Thread Wacek Kusnierczyk
Gabor Grothendieck wrote: - this still does not allow one to use the names directly, only as L$first etc., with the syntactic and semantic (longer lookup times) penalty; That's how it should be done. Using the auto split you get many variables which is not desirable. it encourages bad

Re: [Rd] question

2009-03-07 Thread Wacek Kusnierczyk
Thomas Petzoldt wrote: Patrick Burns wrote: One idea of program design is that users should be protected against themselves. ... and r coherently implements this idea :] It is my experience that users, especially novices, tend to over-split items rather than over-clump items. The fact

Re: [Rd] question

2009-03-06 Thread Mark.Bravington
-project.org] On Behalf Of Gabor Grothendieck [ggrothendi...@gmail.com] Sent: 06 March 2009 09:25 To: ivo welch Cc: r-devel@r-project.org Subject: Re: [Rd] question I posted this a few years ago (but found I never really had a need for it): http://tolstoy.newcastle.edu.au/R/help/04/06/1430.html

Re: [Rd] question

2009-03-05 Thread Gabor Grothendieck
I posted this a few years ago (but found I never really had a need for it): http://tolstoy.newcastle.edu.au/R/help/04/06/1430.html On Thu, Mar 5, 2009 at 9:22 AM, ivo welch ivo...@gmail.com wrote: dear R developers:  it is of course easy for a third party to make suggestions if this third

Re: [Rd] question in value-based color in image()

2008-09-16 Thread Uwe Ligges
M. wrote: Hello, I have a matrix with value varying from -1 to 1. I hope to use scaled color based on its value to produce an image of this matrix. Suppose I hope to label those data in [-1,-0.5] with blue, label those [-0.5,0.8] with light blue (tone is proportional to its value) and label

[Rd] question in value-based color in image()

2008-09-15 Thread M.
Hello, I have a matrix with value varying from -1 to 1. I hope to use scaled color based on its value to produce an image of this matrix. Suppose I hope to label those data in [-1,-0.5] with blue, label those [-0.5,0.8] with light blue (tone is proportional to its value) and label those [0.8,1]

[Rd] Question about Node Classes

2008-06-18 Thread subramanian R
Hi All, I am using R-2.7.0 and am trying to Understand the memory Manager in it. I am a bit confused about The Node Classes .Can Any one explain? *R-Internals states that --- *The `small' vector nodes -- Class 1 to Class 6-- are able to store vector data of up to 8,

[Rd] question about p-value implementation

2008-04-22 Thread Vincent Wolowski
Hello all, I hope I have found the right place for my question. There are different kinds of p-values for one-sided and two-sided tests, for example mid p-value [1], minimum-likelihood p-value [2] or conditional two-sided p-value [3]. I tried to find out what kind of p-value is implemented in R

[Rd] Question on the R's C stack limit

2007-06-28 Thread zhangxiaoning
Hi, Simon all, I try to embed R in my win32 multiple threads program and get c stack error.I have tried to disable the stack limit by setting R_CStackLimit to -1.However, if I do this in R source code \src\gnuwin32\system.c (in functionR_SetWin32(Rstart Rp), after line R_CStackLimit = top -

[Rd] Question about Running C code from R

2007-06-08 Thread Marthews, T. R.
Dear R-devel, Apologies for sending what is probably a very simple question to R-devel: I am definitely missing something very simple and can't work out what it is. I've been trying to find the problem here for about a month and need some help! I am trying to work out how to run a C program

Re: [Rd] Question about Running C code from R

2007-06-08 Thread Prof Brian Ripley
Since you are using Borland C++, the examples in the online complement to 'S Programming' are relevant, as is README.packages. Basically, you have not managed to export any entry points, and to do so you will need to make a DLL and not a .exe. *However* it is much easier to make use of the

[Rd] Question on the R's C stack limit

2007-06-01 Thread Ev Whin
Dear r-devel members, I encountered a C stack limit issue, when I tried to embed R 2.5 into my application. In the R-exts document, it says:Note that R's own front ends use a stack size of 10Mb. I desire to know: is it possible to decrease this stack size by modifying R's source code? If it's

Re: [Rd] Question on the R's C stack limit

2007-06-01 Thread Prof Brian Ripley
On Fri, 1 Jun 2007, Ev Whin wrote: Dear r-devel members, I encountered a C stack limit issue, when I tried to embed R 2.5 into my application. In the R-exts document, it says:Note that R's own front ends use a stack size of 10Mb. I desire to know: is it possible to decrease this stack

Re: [Rd] Question on the R's C stack limit

2007-06-01 Thread Simon Urbanek
On Jun 1, 2007, at 5:44 AM, Ev Whin wrote: Dear r-devel members, I encountered a C stack limit issue, when I tried to embed R 2.5 into my application. If you are embedding R, you can change or disable the stack limit by setting R_CStackLimit appropriately. There is no need to change

Re: [Rd] Question on the R's C stack limit

2007-06-01 Thread Prof Brian Ripley
On Fri, 1 Jun 2007, Simon Urbanek wrote: On Jun 1, 2007, at 5:44 AM, Ev Whin wrote: Dear r-devel members, I encountered a C stack limit issue, when I tried to embed R 2.5 into my application. If you are embedding R, you can change or disable the stack limit by setting R_CStackLimit

[Rd] question about R_ParseVector function

2007-05-29 Thread Ev Whin
Hi r-devel, The R_ParseVector has been changed in R-2.5.0, and there is a simple description about the 4th argument at http://stat.ethz.ch/R-manual/R-patched/NEWS, it says that: R_ParseVector() has a new 4th argument 'SEXP srcfile' allowing source references to be attached to the returned

Re: [Rd] question about R_ParseVector function

2007-05-29 Thread Duncan Murdoch
Ev Whin wrote: Hi r-devel, The R_ParseVector has been changed in R-2.5.0, and there is a simple description about the 4th argument at http://stat.ethz.ch/R-manual/R-patched/NEWS, it says that: R_ParseVector() has a new 4th argument 'SEXP srcfile' allowing source references to be attached to

[Rd] question on docs for delayedAssign and substitute

2007-02-13 Thread Tony Plate
The help files for delayedAssign and substitute both say that substitute() can be used to see the expression associated with a promise. However, I can't see how to do that. When I try the example in help file for delayedAssign I don't see substitute() extracting the promise, e.g.: msg -

Re: [Rd] question on docs for delayedAssign and substitute

2007-02-13 Thread Duncan Murdoch
On 2/13/2007 1:34 PM, Tony Plate wrote: The help files for delayedAssign and substitute both say that substitute() can be used to see the expression associated with a promise. However, I can't see how to do that. When I try the example in help file for delayedAssign I don't see

[Rd] question about trailing arguments in an S4 method

2006-12-16 Thread Ben Bolker
I'm trying to add arguments to the AIC method for some classes -- things like weights=TRUE to calculate AIC weights corr=TRUE, nobs to calculate AICc delta=TRUE to put a delta-AIC column in the output. The problem is that AIC is defined as AIC(object, ..., k=2) where k is the constant

Re: [Rd] question about trailing arguments in an S4 method

2006-12-16 Thread Prof Brian Ripley
I don't see how this can work, in S3 or S4. Callers of AIC are entitied to expect it to behave as described on the help page, and so to be able to pass objects called (e.g.) 'delta' and get back exactly the value mentioned. For what you seem to want to do, I think you need your own generic.

Re: [Rd] question about trailing arguments in an S4 method

2006-12-16 Thread Seth Falcon
Ben Bolker [EMAIL PROTECTED] writes: I'm trying to add arguments to the AIC method for some classes -- things like weights=TRUE to calculate AIC weights corr=TRUE, nobs to calculate AICc delta=TRUE to put a delta-AIC column in the output. The problem is that AIC is defined as

Re: [Rd] question about trailing arguments in an S4 method

2006-12-16 Thread Byron Ellis
He wants to specify arguments to AIC that act like the k argument and is thinking of faking it by, essentially, doing another round of argument matching on ... I think that if you define an S4 generic that only dispatches on the first argument you may be able to do it for a specific method. On

Re: [Rd] Question about substitute() and function def

2006-09-15 Thread Peter Dalgaard
Duncan Murdoch [EMAIL PROTECTED] writes: substitute(function(a=a) 1, list(a=quote(foo))) function(a = a) 1 a bug for sure Yes. Hmm... The issue is that the argument to `function` is a pairlist (not LANGSXP), and we don't recurse into those. Any R object can turn up as part of

[Rd] Question about substitute() and function def

2006-09-14 Thread Seth Falcon
Hi, Can someone help me understand why substitute(function(a) a + 1, list(a=quote(foo))) gives function(a) foo + 1 and not function(foo) foo + 1 The man page leads me to believe this is related to lazy evaluation of function arguments, but I'm not getting the big picture. Thanks, +

Re: [Rd] Question about substitute() and function def

2006-09-14 Thread Duncan Murdoch
On 9/14/2006 3:01 PM, Seth Falcon wrote: Hi, Can someone help me understand why substitute(function(a) a + 1, list(a=quote(foo))) gives function(a) foo + 1 and not function(foo) foo + 1 The man page leads me to believe this is related to lazy evaluation of function

Re: [Rd] Question about substitute() and function def

2006-09-14 Thread Bill Dunlap
On Thu, 14 Sep 2006, Duncan Murdoch wrote: I think it's the same reason that this happens: substitute(c( a = 1, b = a), list(a = quote(foo))) c(a = 1, b = foo) The a in function(a) is the name of the arg, it's not the arg itself (which is missing). Now a harder question to answer is why

Re: [Rd] Question about substitute() and function def

2006-09-14 Thread Robert Gentleman
Duncan Murdoch wrote: On 9/14/2006 3:01 PM, Seth Falcon wrote: Hi, Can someone help me understand why substitute(function(a) a + 1, list(a=quote(foo))) gives function(a) foo + 1 and not function(foo) foo + 1 The man page leads me to believe this is related to lazy

Re: [Rd] Question about substitute() and function def

2006-09-14 Thread Bill Dunlap
On Thu, 14 Sep 2006, Robert Gentleman wrote: substitute(c( a = 1, b = a), list(a = quote(foo))) c(a = 1, b = foo) The a in function(a) is the name of the arg, it's not the arg itself yes, but the logic seems to be broken. In Seth's case there seems to be no way to use substitute to

Re: [Rd] Question about substitute() and function def

2006-09-14 Thread Duncan Murdoch
On 9/14/2006 3:49 PM, Robert Gentleman wrote: Duncan Murdoch wrote: On 9/14/2006 3:01 PM, Seth Falcon wrote: Hi, Can someone help me understand why substitute(function(a) a + 1, list(a=quote(foo))) gives function(a) foo + 1 and not function(foo) foo + 1 The man page leads

Re: [Rd] Question about match.fun()

2006-05-11 Thread Prof Brian Ripley
On Tue, 9 May 2006, Berwin A Turlach wrote: Dear all, I was recently contacted by a user about an alledged problem/bug in the latest version of lasso2. After some investigation, we found out that it was a user error which boils down to the following: x - matrix(rnorm(200), ncol=2) var -

[Rd] Question about match.fun()

2006-05-09 Thread Berwin A Turlach
Dear all, I was recently contacted by a user about an alledged problem/bug in the latest version of lasso2. After some investigation, we found out that it was a user error which boils down to the following: x - matrix(rnorm(200), ncol=2) var - fred apply(x, 2, var) Error in get(x, envir,

Re: [Rd] Question on help system under windows

2006-02-09 Thread Uwe Ligges
Berwin A Turlach wrote: G'day all, I spend today sometime playing around with R under Windows since our lecturing starts in 2 weeks again and our IT guys want to know which version to put onto our lab machines. I noticed the following: Under R-2.2.1, I obtain the following output:

Re: [Rd] Question about colnames behavior

2005-10-03 Thread Martin Maechler
Erich == Erich Neuwirth [EMAIL PROTECTED] on Sun, 02 Oct 2005 09:39:36 +0200 writes: Erich The following code Erich zzz-1:10 Erich dim(zzz)-10 Erich rownames(zzz) Erich colnames(zzz) Erich yields NULL for the rownames and colnames calls. Erich Let us set

Re: [Rd] Question about colnames behavior

2005-10-03 Thread Prof Brian Ripley
On Mon, 3 Oct 2005, Martin Maechler wrote: Erich == Erich Neuwirth [EMAIL PROTECTED] on Sun, 02 Oct 2005 09:39:36 +0200 writes: Erich The following code Erich zzz-1:10 Erich dim(zzz)-10 Erich rownames(zzz) Erich colnames(zzz) Erich yields NULL for the rownames and

Re: [Rd] Question about colnames behavior

2005-10-03 Thread Martin Maechler
BDR == Prof Brian Ripley [EMAIL PROTECTED] on Mon, 3 Oct 2005 09:44:47 +0100 (BST) writes: BDR On Mon, 3 Oct 2005, Martin Maechler wrote: Erich == Erich Neuwirth [EMAIL PROTECTED] on Sun, 02 Oct 2005 09:39:36 +0200 writes: Erich The following code Erich zzz-1:10

[Rd] Question about colnames behavior

2005-10-02 Thread Erich Neuwirth
The following code zzz-1:10 dim(zzz)-10 rownames(zzz) colnames(zzz) yields NULL for the rownames and colnames calls. Let us set rownames rownames(zzz)-1:10 Now rownames(zzz) returns the expected result, but colnames(zzz) produces an error: Error in dn[[2]] : subscript out of bounds So given a

[Rd] Question about package's DESCRIPTION/Depends field

2005-09-01 Thread Tuszynski, Jaroslaw W.
Hi, My package caMassClass depends on several other packages, one of them PROcess residing on Bioconductor website. Bioconductor repository is not, listed in default set of repositories in current version of R (Windows R 2.1.1). As a result people installing my package have to change that

Re: [Rd] Question about package's DESCRIPTION/Depends field

2005-09-01 Thread Kurt Hornik
Tuszynski, Jaroslaw W writes: Hi, My package caMassClass depends on several other packages, one of them PROcess residing on Bioconductor website. Bioconductor repository is not, listed in default set of repositories in current version of R (Windows R 2.1.1). As a result people installing my

Re: [Rd] Question about SET_LENGTH

2005-08-29 Thread Prof Brian Ripley
SET_LENGTH is in Rdefines.h (you did not say). It is a wrapper for x = lengthgets(x, n) and that will do what you want. HOWEVER, you have changed x and the object it points to, so you do need to worry about re-protection. So, I think that macro is rather dangerous (and it is not the

<    1   2   3