Error importing numbers with decimals in R

3

I am trying to import a column of decimals into csv (part of a dataset) through the function read_delim . However, the columns with decimal numbers (separated by commas in the original dataset) are coming as integers.

Ex:

  • 175,60 appears as 17560
  • 98.6851 appears as 986851

Does anyone know how to solve this?

    
asked by anonymous 15.10.2018 / 13:47

1 answer

4

The read_delim function is not able to deal with numbers with commas. Use the read.csv function with the argument dec="," :

read.csv(file="arquivo.csv", dec=",", sep=";")

Note that I also used the argument sep=";" above. So, I'm assuming that the column separator in your file is the ; character. If it is a tab tag, use sep="\t" .

    
15.10.2018 / 14:16