1.

What is the function to set column names for a matrix?(a) names()(b) colnames()(c) col.names()(d) column name cannot be set for a matrixThis question was posed to me in a national level competition.This intriguing question originated from Overview of R in division History, Overview and Getting Started of R Programming

Answer»

The correct option is (b) colnames()

The explanation: colnames() is the FUNCTION to set column names for a matrix. rownames() is the function to set ROW names for a matrix. But we can’t use both at a time. Column names and row names can be set separately using the colnames() and rownames() functions.



Discussion

No Comment Found

Related InterviewSolutions