+ 2
Grade Analysis R program . Can you please help me to solve this problem. Thanks in Advance
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.
12 Respostas
+ 9
print(length(data$grade[data$grade > x ]))
+ 4
This is only the code that it is already given.
Hint:
* subset the grade column so that you only keep keep the grade > x
* get the length of the remaining vector
+ 4
print(length(t(subset(data, grade>x)["grade"])))
+ 2
MD Mehedi Hasan
This is not your code. where is your attempts?
+ 2
It's corrected now. It should work fine.
+ 1
Hi, please link your code so we can help you!
+ 1
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)
)
+ 1
SUNDAY Amos No, shouldn't work, R is case-sensitive
+ 1
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))
print(length(t(subset(data,data$grade>x)["grade"])))
0
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)
)
pet <- subset(data, grade>x)
Print(length(pet$grade))
#Should work fine.đ
0
@SUNDAY Amos
line 9, lower case P not capitol
0
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))
print(length(t(subset(data,data$grade>x)["grade"])))