To find the largest element in an array in R, you can use the max()
function. You can also use indexing or the apply()
function to find the maximum values in array.
Here is an example of using the max()
function:
main.r185 chars9 lines
Output:
main.r6 chars2 lines
Here is an example of using indexing to find the maximum value in the array:
main.r279 chars12 lines
Output:
main.r6 chars2 lines
Here is an example of using the apply()
function to find the maximum value in the array:
main.r214 chars9 lines
Output:
main.r40 chars3 lines
gistlibby LogSnag