3 Data objects The dist() function is an R built-in function that takes a matrix (or a...
Fantastic news! We've Found the answer you've been seeking!
Question:
3 Data objects
The dist() function is an R built-in function that takes a matrix (or a data frame) and returns the distance between the individuals (rows) of the matrix.
a.Without using for loops or apply functions, create a matrix containing 10 rows and 5 columns. The elements of the matrix are integer numbers randomly selected from 1 to 10 (1 point).
b.Apply the dist() function to the above matrix and assign the output to an object called m_dist. Assume that you want to print the distances between the first 6 units. What does head(m_dist) return? What is the class of m_dist? What output would you expect if m_dist was a matrix? Write a code to print the first 6 rows of m_dist. (2 points)
The question b please
Posted Date: