VOOZH about

URL: https://www.geeksforgeeks.org/r-language/fill-an-empty-matrix-in-r/

⇱ Fill an empty matrix in R - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Fill an empty matrix in R

Last Updated : 21 Apr, 2021

In this article, we will discuss how to fill the empty matrix with values in R Programming Language. First, let's create an empty matrix.

Syntax:

matrix_name[row,column]=value.

Where, row and column are the numbers in which the value is occupied.

Example:

Output:

👁 Image

We can replace with same value for all empty value in a matrix, by using [,].

Example

Output:

👁 Image

Even a range can be inserted.

Example

Output:

👁 Image
Comment

Explore