[R] stuff I used to do in Matlab

David A Richmond richmond at saintmarys.edu
Fri Sep 14 04:20:26 CEST 2001


Hi,
	I'm new to R, and trying to map stuff I knew how to do in Matlab
to R. For instances, in matlab, sum(x) gave the column sums of
matrix(/vector) x. In R it just gives the sum of all the elements,
regardless of their form (vector or matrix). Is there a simple way to
return a vector of column sums for a matrix? Also, in Matlab binary
operators exist for concatenating a matrix onto the end or the bottom of
another matrix (i.e. horiz or vertically) but no such operators seem to
exist for R. is there an easy way to concatenate matrices? (I have found a
way which involves several steps, first creating a new matrix of zeros
with dimensions based on the dims of the old ones, and then inserting the
contents of the old matrices into the new one, but this seems very
cumbersome, esp. since I'm used to being able to do it with something like
c = [a,b]. Thanks for entertaining my newbie questions

dave

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|David Richmond                It works on a          |      
+ Dept. of Sociology          complex scientific      + 
|Saint Mary's College          principle, known as    |  
+ Notre Dame, IN 46556               "pot luck."      +
|219-284-4517                    - The Doctor         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list