Turning a double variable into a factor

Asked

Viewed 102 times

0

Hello,

I’m trying to convert a variable of the type double in factor

ppar$abor <- as.factor(ppar$abor)

But I’m getting the following error:

Error in `$<-.data.frame`(`*tmp*`, abor, value = integer(0)) :
  • 2

    Unable to know what is causing the error without a sample of your data. Spin dput(ppar) (or dput(head(ppar)) if the date.frame has many lines) and paste the output into the ask. Or simply provide a sample of the Abor column values.

  • The variables of the type double are continuous variables. Are you sure you want to convert to categorical? (What is the difference between categories 1.0, 1.001 and 1.000000001?)

  • 1

    Another thing, the error message is incomplete, it says only that there is an error in the function $<-.data.frame but it lacks the error itself. What did it say right away?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.