The class of variable

Why i get this erorr?

ageg <- cut(df$Age , breaks = c(20, 24, 29, 34, 39, 44, 49, 54, 59, 65))
Error in cut.default(df$Age, breaks = c(20, 24, 29, 34, 39, 44, 49, 54, :
'x' must be numeric

however, the class of age is numeric!!!

class(df$age)
[1] "numeric"

Hi @fary,

This is indeed odd. Could you share your dataset with dput() so we can take a look at it and try to figure out the issue?

I am afraid. these are secret data.
I am really confused :exploding_head:

R is case sensitive df$Age != df$age

2 Likes

My variable name is "Age".

Then why you use this command with "age"?

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.