Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Removing scientific notation format from character column type

I have an issue where I have a column in a dataframe that is a character type as there is text in it so I cannot force it to be numeric. But I also have values that show up as scientific notation that I would like to convert and remove the scientific notation.

In the data assume there is an unknown amount of these values that need to be converted. How best can I remove the scientific notation from this type of data?

Example data:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

vector <- c("HMM","5.8779396207367296E+17","GOLF","3191963","355534317","8.837971002284400E+16")
exampledf <- as.data.frame(vector)

what I would like it to look like:

vector <- c("HMM","587793962073672960","GOLF","3191963","355534317","80837971002284400")

>Solution :

You can use type.convert:

as.character(type.convert(as.list(vector), as.is = TRUE))
#[1] "HMM" "587793962073672960" "GOLF" "3191963" "355534317" "88379710022844000" 
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading