how to turn a factor variable into a numeric in R?

Asked

Viewed 2,309 times

1

Good morning I am importing a txt format database and the values comes in factor but I want in Numeric. How do I?

  • If this is occurring, it must have some non-numeric character in the column. If it is one that indicates Missing value, use the argument na.strings. It is better to try to solve the problem in the data before making this conversion.

  • Good morning Molx, thank you very much for the answer. After applying your suggestion I started to have the variable as a character. Send me your mail I’ll check the database. Hugs

1 answer

-2

Dude, try the following:

variavel <- data.frame(nome_da_base, stringsAsFactors = F)

Browser other questions tagged

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