dimanche 4 juillet 2021

Can anybody find an error in the R code containing ifelse()?

I am new to R and was trying to get through some challenges on R programming. I am getting the same output as intended in the question. But, somehow the test cases are not passing. Can anyone help me find out if there is any error in printing output?

Please have a look at the attached picture for clarity.enter image description here

My Code:

conditional <- function(V){
    status <- ifelse(V>=80,"Above_Average","Average")
    res = paste(status, collapse=" ")
    print(noquote(res))
}

conditional(c(78,85,90))

Aucun commentaire:

Enregistrer un commentaire