x must be a numeric number

As @FJCC notes, irreproducible problems breed few answers.

See the FAQ: How to do a minimal reproducible example reprex for beginners.

Eyeballing it (subject to the vagaries of eyes older than 70), it looks like this is similar to

class(mtcars$mpg)
#> [1] "numeric"

which doesn't need sapply at all.