octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dataframe dereferencing


From: Judd Storrs
Subject: Re: dataframe dereferencing
Date: Thu, 2 Sep 2010 09:43:12 -0400

On Thu, Sep 2, 2010 at 4:35 AM, CdeMills <address@hidden> wrote:
x(1:3, 1:2)(:).cell
y = x(1:3, 1:2)(:)
z = y.cell

I understand why you are doing this, but one thing to be aware of is that the idiomatic way to do casting is to call a constructor. e.g. this is how I would naively approach this based on how things are done in Matlab:

cell(x(1:3, 1:2)(:))
y = x(1:3, 1:2)(:)
z = cell(y)

For user-written classes, I think you can either provide @foo/foo.m or @dataframe/foo.m, but I'm not 100% certain because I haven't done this in a while.

I'm very interested in dataframe but I haven't had a chance to look at it yet. Based only on this thread one question I had was whether dataframe already implement cell-style "{}" indexing in addition to the "()" indexing? If not, maybe that could be used to distinguish between the "I want the data" and "I want a dataframe subset" uses.

x(1:3) # <-- return data if appropriate
x{1:3} # <-- return truncated dataframe

Then these may all do slightly different things:

z = x{1:3, 1:2}{:}
z = x(1:3, 1:2)(:)
z = x{1:3, 1:2}(:)


--judd

reply via email to

[Prev in Thread] Current Thread [Next in Thread]