[Rd] inconsistency between plot(hist(...)) and hist(...) (PR#8376)

2005-12-10 Thread clausen
Full_Name: Andrew Clausen Version: 2.1.0 OS: Debian GNU/Linux Submission from: (NULL) (71.242.192.73) Hi, When I type hist(x, freq=F) I get a density function, as I expect. However, if I type plot(hist(x, freq=F)) then I get the same output as if I had typed: hist(x, freq=T

Re: [Rd] (PR#8376 inconsistency between plot(hist(...)) and hist(...)

2005-12-10 Thread clausen
Hi Brian, On Sun, Dec 11, 2005 at 04:34:50AM +, Prof Brian Ripley wrote: > Did you check the help page? ?plot.histogram shows plot.histogram has a > 'freq' argument, and the correct usage is > > plot(hist(x), freq=FALSE) Ah, thanks for the explanation. I didn't occur to me to check the pl

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

[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

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
Hi all, I've written a new version of relist that includes the suggestions from Gabor and Martin: http://www.econ.upenn.edu/~clausen/computing/relist.R The leading example now looks like this: initial.param <- list(mean=c(0, 1), vcov=cbind(c(1, 1)

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
t;missing") rather than just "numeric". I have uploaded a new version here: http://www.econ.upenn.edu/~clausen/computing/relist.R Cheers, Andrew __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

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
because it best matches my current projects. Here's a quick summary of what I've done: * implemented my own version of BFGS in R, http://www.econ.upenn.edu/~clausen/computing/bfgs.zip * written a wrapper for the GNU Scientific Library's optimization function,

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