Hi Gabor,
Can you suggest some examples of how your proposal could be used?
Reshape never returns a vector.
Cheers,
Andrew
On Tue, May 22, 2007 at 07:36:56PM -0400, Gabor Grothendieck wrote:
One additional idea.
I wonder if reshape might be promoted to a generic and relist made
into
# returns list(a1 = 1, a2 = 2, b = 3) with an attribute
# reshapeLong containing skeleton (existing reshape also uses
# reshapeWide and reshapeLong attributes)
L - list(a = 1:2, b = 3)
long - reshape(L, direction = long)
# returns original list but with an attribute reshapeWide
reshape(long,
Andrew Clausen [EMAIL PROTECTED] writes:
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
On 5/23/07, Seth Falcon [EMAIL PROTECTED] wrote:
Andrew Clausen [EMAIL PROTECTED] writes:
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
GaGr == Gabor Grothendieck [EMAIL PROTECTED]
on Wed, 23 May 2007 08:56:50 -0400 writes:
GaGr On 5/23/07, Seth Falcon [EMAIL PROTECTED] wrote:
Andrew Clausen [EMAIL PROTECTED] writes:
Hi Seth,
On Mon, May 21, 2007 at 05:15:10PM -0700, Seth Falcon wrote:
On 5/23/07, Martin Maechler [EMAIL PROTECTED] wrote:
GaGr == Gabor Grothendieck [EMAIL PROTECTED]
on Wed, 23 May 2007 08:56:50 -0400 writes:
GaGr On 5/23/07, Seth Falcon [EMAIL PROTECTED] wrote:
Andrew Clausen [EMAIL PROTECTED] writes:
Hi Seth,
On Mon, May
On 5/23/07, Gabor Grothendieck [EMAIL PROTECTED] wrote:
On 5/23/07, Martin Maechler [EMAIL PROTECTED] wrote:
GaGr == Gabor Grothendieck [EMAIL PROTECTED]
on Wed, 23 May 2007 08:56:50 -0400 writes:
GaGr On 5/23/07, Seth Falcon [EMAIL PROTECTED] wrote:
Andrew Clausen [EMAIL
On 5/23/07, hadley wickham [EMAIL PROTECTED] wrote:
On 5/23/07, Gabor Grothendieck [EMAIL PROTECTED] wrote:
On 5/23/07, Martin Maechler [EMAIL PROTECTED] wrote:
GaGr == Gabor Grothendieck [EMAIL PROTECTED]
on Wed, 23 May 2007 08:56:50 -0400 writes:
GaGr On 5/23/07, Seth
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
AndrewC == Andrew Clausen [EMAIL PROTECTED]
on Tue, 22 May 2007 07:51:54 -0400 writes:
AndrewC Hi Seth,
AndrewC 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.
One additional idea.
I wonder if reshape might be promoted to a generic and relist made
into methods for it. The unlisted version of an object would be the long
version and the original version of the list would be the wide version.
This would consolidate the two concepts together and make it
Hi Andrew,
Andrew Clausen [EMAIL PROTECTED] writes:
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:
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), c(1, 0)))
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,
unlist would not attach a skeleton to every vector it returns, only
the relist method of unlist would. That way just that method needs
to be added and no changes to unlist itself are needed.
Before applying unlist to an object you would coerce the object to
class relist to force the relist
Nice ideas, Gabor and Andrew.
While I agree with Andrew that such a utility makes for nicer
and considerably better maintainable code in examples like his,
and I do like to provide inverse operator functions in R
whenever sensible,
OTOH, we have strived to keep R's base package as lean and
clean
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
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. I meant to say:
R has a
I suggest you define a relist class and then define an unlist
method for it which stores the skeleton as an attribute. Then
one would not have to specify skeleton in the relist command
so
relist(unlist(relist(x))) === x
1. relist(x) is the same as x except it gets an additional class relist.
2.
19 matches
Mail list logo