+ 3

Can solve this question ? In R language

You have a dataframe that includes grades of students. Your program needs to take a number as input, and output the number of students who have a grade greater than the given input. For example, for the input 89, the output should be: [1] 3 as 3 students have grades greater than 89.

3rd Sep 2021, 11:36 AM
Niloufar Kashanian
Niloufar Kashanian - avatar
5 Respostas
+ 3
Niloufar Kashanian This is not your attempts. Where is your attempts? Hint - filter data using given input then use length() function to count students.
3rd Sep 2021, 11:53 AM
A͢J
A͢J - avatar
+ 2
Attempt?
3rd Sep 2021, 11:43 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 2
input <- readLines('stdin') x <- as.integer(input[1]) data <- data.frame( "id" = c(1:10), "grade" = c(75, 26, 54, 90, 86, 93, 48, 71, 66, 99) )
3rd Sep 2021, 11:47 AM
Niloufar Kashanian
Niloufar Kashanian - avatar
+ 2
input <- readLines('stdin') x <- as.integer(input[1]) data <- data.frame( "id" = c(1:10), "grade" = c(75, 26, 54, 90, 86, 93, 48, 71, 66, 99) ) y = subset(data, data$grade > x ) print (length(y$grade))
3rd Sep 2021, 12:28 PM
SoloProg
SoloProg - avatar