[R] binary operators that implement row and column sweeps of matrices by vectors

Steven Rytina steven.rytina at mcgill.ca
Sun Aug 9 13:03:36 CEST 2009


----- Original Message ----- 
From: "Peter Dalgaard" <p.dalgaard at biostat.ku.dk>
To: "Steven Rytina, Prof." <steven.rytina at mcgill.ca>
Cc: <r-help at r-project.org>
Sent: Sunday, August 09, 2009 6:35 AM
Subject: Re: [R] binary operators that implement row and column sweeps of 
matrices by vectors


Steven Rytina wrote:
>
>                 Submitted for perusal, comment, improvements, and/or 
> critique. The presentation is in 3 sections:  motivation, code, and 
> comment.
>
>
>
> Motivation:
>
>
>
>             As a new-comer to R from matrix oriented Gauss and Mata, I 
> miss the
tools for using a vector (and operator) to ‘sweep’ across a matrix.

And you have checked that this is not possible using sweep()??


  That was an initial possibility, to be sure. But what was left open was 
how to implement imposing an arbitrary vector of suitable length and how to 
implement strict conformability. My take is that once one has a 'wrapper' 
like mine that classifies the possibilities, there is no great difference in 
using mapply() as I did versus, say, sweep().

    But perhaps that is in error??

    On the other hand, it seems plausible that using sweep() might lead to 
insight into generalizations, like M dimensions swept by K. And while that 
would be cool it doesn't serve any practical purpose I know about.



-- 
    O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
   c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
  (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907




More information about the R-help mailing list