How to Create an Empty Matrix in R (Example Code)

In this R tutorial you’ll learn how to construct empty matrices.

Example: Create Empty Matrix in R

example_matrix <- matrix(ncol = 5,    # Using matrix() function in R
                         nrow = 0)
example_matrix                        # Return empty matrix to RStudio console
# [,1] [,2] [,3] [,4] [,5]

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

Menu
Top