How to find the amount of values that are greater than the mean of a vector?

Duda en el siguiente ejercicio Cree script que retorne la cantidad de valores que son mayores que la media de un vector.YO trate de hacerlo de esta manera pero no corre count

library(dplyr)
x= 1:30
y= mean(x)
print(y)

for(i in x) {
  if(i >y)
  {
   print(count(i)) 
  }
}

Look at the results of running the code below. Does that show you how to solve your problem?

x <- 1:30
x > 9
sum(x > 9)
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.