Convert a character in a tibble

I just started myself trying to learn R and I am facing a problem. I am trying to do a binomial logistic regression. Everything is fine about that, only that R is showing one coefficent in chr instead of dbl which is working for the others. How can I change that?

As I am not sure how to proper upload R code here, I will put it as a png.

You can use the as.numeric function to convert the column to numbers but I expect you will get a warning "NAs introduced by coercion" because something in that column does not look like a number to R. You can find what that is like this (I will assume your tibble is called DF):

VALS <- DF$ADR
NUMs <- as.numeric(VALS) #you should get the warning here
BadLocations <- which(is.na(NUMs))
BadLocations #this will tell you what row(s) the bad values are in 
BadVals <- VALS[BadLocations]
BadVals

Once you know what is preventing the column from being read as numbers, you can delete it or replace it or let the as.numeric function convert it to NA.

DF$ADR <- as.numeric(DF$ADR)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.