1.

Which of the following finds row sums for each level of a grouping variable?(a) as.numeric(x)(b) rowsum(x, group, reorder = TRUE, …)(c) as.order(x)(d) colSums (x, na.rm = FALSE, dims = 1)The question was posed to me in examination.This is a very interesting question from Commands in portion Commands, Packages, Visualizing Data and Linear Regression of R Programming

Answer»

Correct choice is (b) rowsum(x, group, reorder = TRUE, …)

Explanation: rowsum compute column SUMS across ROWS of a numeric matrix-like object for each LEVEL of a grouping VARIABLE.



Discussion

No Comment Found

Related InterviewSolutions