Negative number is character. Want to change to double

Even with numbers as quoted characters this works as expected for me, could you make a reproducible example of your issue?

x <- "5"
y <- "-5"
as.numeric(x)
#> [1] 5
as.numeric(y)
#> [1] -5

If you've never heard of a reprex before, you might want to start by reading this FAQ:

1 Like