x must be a numeric number

hi, can anybody helps me with this?

Is the result of

mode(Book1[, "SPI"])


Oops! I just saw you did that test. Never mind.

oh no, the result of mode(Book1[, "SPI"])

is "list"

what should i do?

Are you sure you didn't run


by mistake? You already tested

class(Book1[, "SPI"])

and got "numeric". If you run mean(Book1[, "SPI"]), do you get an error or a number? If you get a number, the the problem lies with sens.slope not seeing the data as numeric. If you get an error, then somehow your result using class() is misleading me.
Also, try running sens.slope on another data frame with data others can reproduce.

DF <- data.frame(SPI = rnorm(100))
sens.slope(DF[, "SPI"])

I have to stop for the day but others should be able to help you.

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

#> [1] "numeric"

which doesn't need sapply at all.

it became like this


i got it like this! but why when i;


i get 'x' is not a numeric?

and when i mean;
i get an error

There's only so much that's possible with a screenshot.

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

1 Like

Books1 must be a tibble which is a type of data.frame
The square bracket syntax works differently for it than a traditional data.frame.


(irisframe <- head(iris))
(iristibble <- tibble(irisframe))

# $ syntax - same

# square bracket syntax - different

# dplyr syntax - same
irisframe %>% pull(Sepal.Length)
irisframe %>% pull("Sepal.Length")
iristibble %>% pull(Sepal.Length)
iristibble %>% pull("Sepal.Length")
1 Like

This topic was automatically closed 21 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.