A = matrix(
    # Taking sequence of elements 
    c(1, 2, 3, 4, 5, 6, 7, 8, 9),
    
    # Number of rows
    nrow = 3,  
    
    # Number of columns
    ncol = 3,        
    
    # By default matrices are in column-wise order
    # So this parameter decides how to arrange the matrix
    byrow = TRUE,
    
    # Specifies the name given to each element of
    # rows and columns of a matrix
    dimnames = list(c("r1","r2","r3"), c("c1","c2","c3"))
)
 
# Column and row names can also be assigned like so:
# rownames(A) = c("a", "b", "c")
# colnames(A) = c("foo", "bar", "baz")