Set decimal separator within read_delim

Viewed 3695

I want to import a dataset where numbers are formatted with commas of decimal points, i.e. 0,5 instead of 0.5

Here is the dummy data.

ID|Item|Transaction Type|Country|Product Code|LCY_1|LCY_2|LCY_ 3|Country Code
1801|Furniture|D|Scotland|0|-15,234|-15,14|-15,34|SC
1802|Book|D|Wales|0|-15,234|-15,14|-15,34|WL
1803|Phone|D|UK|0|-21,234|-15,14|-15,34|UK
1804|Earbuds|D|Ireland|0|-19,234|-15,14|-15,34|IR
1805|Mug|D|Ireland|0|-32,234|-18,14|-15,34|SC

Was able to import as follows to the most proper view. However, didn't set "," as decimal separator within read_delim(). Also tried with read_csv() using del = "," but didn't work.

df <- read_delim("df.csv", "|", quote = "\\\"", 
escape_double = FALSE, trim_ws = TRUE)

How can I import that successfully?

0 Answers
Related