One way to find the median of an array in R is to first convert the array into a vector using the c()
function, and then use the median()
function. Here's an example:
main.r175 chars12 lines
In this example, we first create an array using the array()
function with dimensions 2x3. We then convert it to a vector using c()
, which concatenates all the values in the array. Finally, we find the median of the vector using median()
and print the result.
gistlibby LogSnag