To find the length of an array in R, you can use the length()
function. The length()
function returns a scalar integer value representing the number of elements in an array. Here's an example:
main.r197 chars9 lines
This will output:
main.r6 chars2 lines
In this example, the my_array
array contains 6 elements and has 2 rows and 3 columns. The length()
function returns 6, which is the number of elements in the array.
gistlibby LogSnag