Re: [Rd] extension to missing()? {was "hist() ... helpful warning? (PR#8376)"}

2005-12-12 Thread Andrew Clausen
Hi Martin, On Mon, Dec 12, 2005 at 12:20:06PM +0100, Martin Maechler wrote: > AndrewC> I didn't occur to me to check the plot.histogram() > AndrewC> help page. > > [ even though it's prominently mentioned on help(hist) ?? ] Yes. I expected plot.histogram() was something that no-one

[Rd] [patch] add is.set parameter to sample()

2010-03-23 Thread Andrew Clausen
Hi all, sample() has some well-documented undesirable behaviour. sample(1:6, 1) sample(2:6, 1) ... sample(5:6, 1) do what you expect, but sample(6:6, 1) sample(1:6, 1) do the same thing. This behaviour is documented: If 'x' has length 1, is numeric (in the sense of 'is.numeric') and

Re: [Rd] [patch] add is.set parameter to sample()

2010-03-23 Thread Andrew Clausen
Hi all, I forgot to test my patch! I fixed a few bugs. Cheers, Andrew On 22 March 2010 22:53, Andrew Clausen wrote: > Hi all, > > sample() has some well-documented undesirable behaviour. > > sample(1:6, 1) > sample(2:6, 1) > ... > sample(5:6, 1) > > do what you

Re: [Rd] [patch] add is.set parameter to sample()

2010-03-25 Thread Andrew Clausen
It's bad enough that there is a surprise, but even worse that there is no workaround that my students can understand easily. Cheers, Andrew On 25 March 2010 06:53, Martin Maechler wrote: >>>>>> "AndrewC" == Andrew Clausen >>>>>>     on Tue, 23 M

[Rd] symbollic differentiation in R

2007-05-13 Thread Andrew Clausen
Hi all, I wrote a symbollic differentiation function in R, which can be downloaded here: http://www.econ.upenn.edu/~clausen/computing/Deriv.R http://www.econ.upenn.edu/~clausen/computing/Simplify.R It is just a prototype. Of course, R already contains two differentiation functio

[Rd] relist, an inverse operator to unlist

2007-05-13 Thread Andrew Clausen
Hi all, I wrote a function called relist, which is an inverse to the existing unlist function: http://www.econ.upenn.edu/~clausen/computing/relist.R Some functions need many parameters, which are most easily represented in complex structures. Unfortunately, many mathematical functions i

Re: [Rd] relist, an inverse operator to unlist

2007-05-13 Thread Andrew Clausen
On Sun, May 13, 2007 at 01:29:11PM -0400, Andrew Clausen wrote: > R has a function to convert complex objects into a vector > representation. This file provides an inverse operation called "unlist" to > convert vectors back to the convenient structural representation. Oops.

Re: [Rd] relist, an inverse operator to unlist

2007-05-13 Thread Andrew Clausen
)) === x > > 1. relist(x) is the same as x except it gets an additional class "relist". > 2. unlist(relist(x)) invokes the relist method of unlist on relist(x) > returning another relist object > 3. relist(unlist(relist(x))) then recreates relist(x) > > > On 5/1

Re: [Rd] optim bug (PR#9684)

2007-05-15 Thread Andrew Clausen
On Tue, May 15, 2007 at 07:02:56PM +0100, Prof Brian Ripley wrote: > In R you rarely need to pass additional arguments in programming as > lexical scoping can be used to capture them. You can also use currying, like this: ll <- function(data) function(params) { #

Re: [Rd] relist, an inverse operator to unlist

2007-05-19 Thread Andrew Clausen
<- function(x, ...) { > GaGr> y <- x > GaGr> cl <- class(y) > GaGr> class(y) <- cl[- grep("relist", cl)] > GaGr> z <- unlist(y) > GaGr> attr(z, "relist") <- y > GaGr> as.relist(z) > GaG

Re: [Rd] relist, an inverse operator to unlist

2007-05-19 Thread Andrew Clausen
Hi all, For reasons I can't explain, the code I posted worked in my session, but didn't work when I started a fresh one. standardGeneric() seems to get confused by defaults for missing arguments. It looks for a "missing" method with this code: relist <- function(flesh, skeleton=attr(fle

Re: [Rd] relist, an inverse operator to unlist

2007-05-22 Thread Andrew Clausen
Hi Seth, On Mon, May 21, 2007 at 05:15:10PM -0700, Seth Falcon wrote: > I will also add that the notion of a default argument on a generic > function seems a bit odd to me. If an argument is available for > dispatch, I just don't see what sense it makes to have a default. In > those cases, the d

Re: [Rd] relist, an inverse operator to unlist

2007-05-23 Thread Andrew Clausen
gt; would perform the inversion. > > I am not sure if the reshape package has any bearing here > as well. > > On 5/22/07, Andrew Clausen <[EMAIL PROTECTED]> wrote: > >Hi Seth, > > > >On Mon, May 21, 2007 at 05:15:10PM -0700, Seth Falcon wrote: > >> I

[Rd] Optimization in R

2007-08-03 Thread Andrew Clausen
Hi all, I've been working on improving R's optim() command, which does general purpose unconstrained optimization. Obviously, this is important for many statistics computations, such as maximum likelihood, method of moments, etc. I have focused my efforts of the BFGS method, mainly because it be

Re: [Rd] Optimization in R

2007-08-04 Thread Andrew Clausen
Hi Pat, On Sat, Aug 04, 2007 at 09:59:57AM +0100, Patrick Burns wrote: > Sounds like a good project. Thanks :) > How much extra overhead are you getting from the > algorithm being in R? On the Rosenbrock function (which is very quick to evaluate), here are the system.time() results: > system.t

Re: [Rd] Optimization in R

2007-08-04 Thread Andrew Clausen
Hi Duncan, On Sat, Aug 04, 2007 at 09:25:39AM -0400, Duncan Murdoch wrote: > This is interesting work; thanks for doing it. Could I make a > suggestion? Why not put together a package containing those test > optimization problems, and offer to include other interesting ones as > they arise?

Re: [Rd] Optimization in R

2007-08-04 Thread Andrew Clausen
Hi Manuel, My multimin() wrapper will be merged into the Rgsl package. I expect that the wrapper doesn't do anything special (compared to the rest of Rgsl) to break the compilation -- you're just having trouble with my very crude and temporary Makefile. Does Rgsl work for you? If it does, you c

Re: [Rd] Sligthly OT Re: Makefile for embedding OpenBUGS in R package

2007-08-06 Thread Andrew Clausen
Hi Hin-Tak, On Tue, Aug 07, 2007 at 01:10:36AM +0100, Hin-Tak Leung wrote: > GPL-licensed code dlopen()'ing proprietary-licensed binary-only DLL/so > is allowed Do you have any evidence? (eg: something written on www.fsf.org?) As far as I know, the normal grounds for allowing GPL code to link w

[Rd] [patch] add=TRUE in plot.default()

2008-03-08 Thread Andrew Clausen
Hi all, As long as I've used R, add=TRUE hasn't worked in contexts like this: f <- function(x) x^2 X <- seq(0, 1, by=1/4) plot(f, col="blue") plot(X, f(X), col="red", type="l", add=TRUE) I attached a fix for version 2.6.2. Cheers, Andrew diff --git a/src/library

Re: [Rd] [patch] add=TRUE in plot.default()

2008-03-09 Thread Andrew Clausen
heers, Andrew On Sun, Mar 09, 2008 at 12:08:59PM -0300, Henrique Dallazuanna wrote: > I think you can use par(new = T) here: > > f <- function(x) x^2 > X <- seq(0, 1, by=1/4) > plot(f, col="blue") > par(new = T) > plot(X, f(X), col="red", type="

Re: [Rd] [patch] add=TRUE in plot.default()

2008-03-09 Thread Andrew Clausen
Hi Duncan, On Sun, Mar 09, 2008 at 12:11:45PM -0400, Duncan Murdoch wrote: > It has never been claimed that it would work, and as far as I can see, > it doesn't make anything easier: the last line could be replaced by > > lines(X, f(X), col="red") > > for more clarity from less typing. So why

Re: [Rd] [patch] add=TRUE in plot.default()

2008-03-09 Thread Andrew Clausen
On Sun, Mar 09, 2008 at 04:04:08PM -0400, Duncan Murdoch wrote: > Part of the reason I didn't like your patch is that it was incomplete: > it didn't patch the plot.default.Rd file. Fair enough -- I wasn't sure whether I was fixing a bug or not. ("..." spreads the documentation around a bit.) >

Re: [Rd] [patch] add=TRUE in plot.default()

2008-03-15 Thread Andrew Clausen
Hi Duncan, On Mon, Mar 10, 2008 at 08:51:23AM -0400, Duncan Murdoch wrote: > >The add parameter only interacts with other parameters superficially -- > >some parameters of "plot" (like log) are related to the shape of the axes, > >and should be inherited from what is on the plot already. > > I'd