Concatenate Two Matrices in R | Append Matrix Object | rbind & rbind.fill.matrix [plyr] Functions

preview_player
Показать описание
R code of this video:

mat1 <- matrix(1:12, ncol = 3) # Create first example matrix
mat1 # Print first example matrix

mat2 <- matrix(21:35, ncol = 3) # Create second example matrix
mat2 # Print second example matrix

mat_combined1 <- rbind(mat1, mat2) # Apply rbind function
mat_combined1 # Print concatenated matrix

mat3 <- matrix(41:56, ncol = 4) # Create third example matrix
mat3 # Print third example matrix

rbind(mat1, mat3) # rbind function leads to error
# Error in rbind(mat1, mat3) :
# number of columns of matrices must match (see arg 2)

library("plyr") # Load plyr package

mat_combined2 # Print concatenated matrix

Follow me on Social Media:
Рекомендации по теме
Комментарии
Автор

I have just started learning data analytics this week. I am glad I found someone to follow and learn from during my first steps

ppr
welcome to shbcf.ru