OneBite.Dev - Coding blog in a bite size

find the length of an array in R

Code snippet on how to find the length of an array in R

  length(array_name)

This code returns the length of a given array. To use it, simply replace “array_name” with the name of the array you want to find the length of. The function will return the length as an integer, which is the number of elements in the array. For example, if the array had 5 elements, the function would return ‘5’. It doesn’t matter what type of data is stored in the array - the length of the array is always the same.

r