[R] newbie- how to add a row to a matrix

Martin Lam tmlammail at yahoo.com
Thu Aug 18 00:34:00 CEST 2005


# row bind
a <- matrix(1:5)
a
a <- rbind(a, 6)
a

# column bind
b <- matrix(1:5)
b
b <- cbind(b, 6:12)
b
b <- cbind(b, 13)
b

Hope this helps,

Martin


--- Simone Gabbriellini <ogabbrie at tin.it> wrote:

> dear list,
> if I have a matrix
> 
> s<-matrix(1:5, ncol=5)
> 
> how can I add another row with other data to that
> matrix?
> 
> thank you,
> simone
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list