[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
dataframe dereferencing
From: |
CdeMills |
Subject: |
dataframe dereferencing |
Date: |
Thu, 2 Sep 2010 01:35:12 -0700 (PDT) |
Hello,
Jaroslav pointed me that MatLab disallow accesses with cascaded parenthesis
a = randn(3, 3)
a(1:2, 1:2)(:)
I designed my dataframe objects with the ability to specify an output type
specifier at the end, like
x(1:3, 1:2)(:).cell. This result is different from
y = x(1:3, 1:2)(:) <= if types are compatible, y is a matrix
z = y.cell <= this results in an error
So I modified the code to accept the following syntax:
x.dataframe; x.df => returns a selection of the dataframe as a dataframe
object
x.cell => returns a selection of a dataframe as a cell array with row and
columns names; this array can be converted back to a dataframe
x.as.something => returns a selection of a dataframe as a matrix of type
something. This permits to extract at once columns of different type,
otherwise the code returns an error. Columns are casted to the type
'something'.
x.as.cell => returns a selection of a dataframe as a cell array without row
and column names
x.attributes => return attributes, valid values are 'rownames', 'colnames',
'rowcnt', 'rowidx', 'colcnt', ...
x.colname => return the column with matching name
With this system:
- chaining rule seems OK to me
- conversion purpose seems more clear
Comment / advices ? Are there standard rules to dereference objects with the
'.' operator ?
Regards
Pascal
--
View this message in context:
http://octave.1599824.n4.nabble.com/dataframe-dereferencing-tp2494732p2494732.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.
- dataframe dereferencing,
CdeMills <=
- Re: dataframe dereferencing, Jaroslav Hajek, 2010/09/02
- Re: dataframe dereferencing, Judd Storrs, 2010/09/02
- Re: dataframe dereferencing, CdeMills, 2010/09/02
- Re: dataframe dereferencing, Jaroslav Hajek, 2010/09/02
- Re: dataframe dereferencing, Judd Storrs, 2010/09/02
- Re: dataframe dereferencing, Jaroslav Hajek, 2010/09/03
- Re: dataframe dereferencing, CdeMills, 2010/09/03
- Re: dataframe dereferencing, Jaroslav Hajek, 2010/09/03
- Re: dataframe dereferencing, Judd Storrs, 2010/09/03