Skip to content

newbie- how to add a row to a matrix

4 messages · Simone Gabbriellini, Sundar Dorai-Raj, Martin Lam

#
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
#
?rbind
Simone Gabbriellini wrote:
#
# 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:

            
#
thank you all

rbind solved my problems!!!

simone

Il giorno 18/ago/05, alle ore 00:34, Martin Lam ha scritto: