0

How the the program executed? how the output is 5? cant understand the part of y,z and print part

What is the output of this code? x <- data.frame( "a" = c(7, 42, 3, 5), "b" = c("a","b","c","d") ) y <- subset(x, a < 10) z <- max(y$a) print(min(mean(y$a), z))

14th Oct 2022, 2:22 PM
REVATHI S
1 Respuesta
0
x stores the data in a table-like structure. y is a subset of x: You only keep the table rows where "a" is smaller than 10. print x and y and compare them z is the max value in the "a"-column of y solve the last line from inner to outer: mean gives the mean value of "a"-column in y. min gives the minimum: either the mean or z.
14th Oct 2022, 2:40 PM
Lisa
Lisa - avatar