I am looking to remove the scientific notation from a vector in R. The vector looks something like this:
print(head(appraiser$Folio))
[1] "1.01E 11" "1.01E 11" "1.01E 11" "1.01E 11"
[5] "1.01E 11" "1.01E 11"
I have tried running
options(scipen = 999)
and
format(appraiser$Folio, scientifc = FALSE)
but neither have removed the notation. Is there any details in how to run these functions that I am missing? Thanks.
CodePudding user response:
One solution would be to convert your vector that doesn't seem to contain numeric values, and after you can convert the scientific notation to numbers :
format(as.numeric(data), scientific = FALSE)
CodePudding user response:
Considering the output you provided, it seems that your column contains text and not numeric values.
Have you tried to convert the column before formating it ? Also, if you want to format number for printing, you can use the format
function. You could do that with something like:
appraiser$Folio <- as.numeric(appraiser$Folio)
print(format(appraiser$Folio, scientific = FALSE))
I hope this helped you!