On 3 Nov 2016, at 00:49, Allin Cottrell <cottrell(a)wfu.edu>
wrote:
On Wed, 2 Nov 2016, Sven Schreiber wrote:
> Am 02.11.2016 um 14:47 schrieb Riccardo (Jack) Lucchetti:
>
>> While we're on the subject:
>
> You recently have a tendency to use this "speaking of which" phrase to
actually do a Monty-Python-esque "and now for something completely different"
...
>
>> brouht up the fact that it's not immediate, in Hansl, to delete certain
row/columns from a matrix.
>
> Yeah, by coincidence I just answered this (old) question yesterday on Stackexchange
(
http://stackoverflow.com/questions/37242922/deleting-a-column-in-hansl).
>
>> but I wouldn't be averse to introducing a function pair like killcol(X, e)
and killrow(X, e). Opinions?
>
> First, it would be an improvement. Second, if at all possible, I would favor some
clever extension of the matrix indexing apparatus. For example (just an example, no claim
of optimality), X[-3, -2] might return the matrix X without the 3rd row and the 2nd
column.
I appreciate that you said "no claim of optimality", but I don't think we
should use negative indices for the purpose you indicate. Seems to me the de facto
standard regarding negative indices in matrix-oriented languages is that they mean,
"count from the end, not the beginning", not "drop these rows or
columns".
Try this in R:
A <- matrix(1:12,nrow=3)
A
A[-1,-2]
displays A without first row and second column.
As I expected and hoped.
Berend