How can I get R to read a column of numbers in exponential notation?

r, statistics

Solution

R can read such numbers just fine; there must be another value in there that's causing the problem.

If you read in your data using `read.table`/`read.csv`/`read.delim`, you can always convert your data to numeric if it didn't import correctly.

x <- as.numeric(as.character(df$x))

where `df` is the name of your data frame, and `x` is the column that you want.

Problem

I'm trying to use R for the first time to make a histogram. I have a file containing one column of 100,000 floating-point numbers ranging in size from 8.85543e-07 to 1.15469e-03. R apparently doesn't recognize them as floating-point numbers because of the 'e' notation. How can I get R to read them. Thanks!

Original source

Related problems