Course Content

Course Content


In R, you must use the matrix function to create a matrix (). The set of elements in the vector are the arguments to this matrix(). You must specify the number of rows and columns that you want in your matrix. Note that matrices are ordered in column-wise order by default.

The square bracket [indexing method] can be used to access elements in a matrix. var[row, column] can be used to access elements. Rows and columns are vectors in this case.

To get a specific column of a matrix, type the column number in square brackets after the matrix variable name, followed by a comma. As a vector, this expression returns the required row.

  • Syntax: matrix(0, n, m) Parameters: 0 – value to initialize the matrix with. n – no. of rows. m – no.
  • Syntax: numeric (m), replicate (n) n is the number of rows. numeric(m) – no.
  • Syntax: repetition (0 , y) y – the number of columns in the matrix. Zeros in a single row matrix as the return type.

Share With Friend

Have a friend to whom you would want to share this course?

Download LearnVern App

App Preview Image
App QR Code Image
Code Scan or Download the app
Google Play Store
Apple App Store
598K+ Downloads
App Download Section Circle 1
4.57 Avg. Ratings
App Download Section Circle 2
15K+ Reviews
App Download Section Circle 3
  • Learn anywhere on the go
  • Get regular updates about your enrolled or new courses
  • Share content with your friends
  • Evaluate your progress through practice tests
  • No internet connection needed
  • Enroll for the webinar and join at the time of the webinar from anywhere