To find the last element in an array in R, you can use indexing or the tail()
function. Here are two examples:
231 chars13 lines
In both cases, you're using length(my_array)
to get the number of elements in the array and then indexing that position to get the last element in the array.
gistlibby LogSnag