[R] stuff I used to do in Matlab

Timothy Bock T.Bock at econ.usyd.edu.au
Fri Sep 14 06:02:23 CEST 2001


> 	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. 


#column sums
margin.table(x,2)
# or
apply(z,2,sum)

> 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? 

# horizontally
cbind(x1,x2)
# vertically
rbind(x1,x2)

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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