I have squared data in a txt file with "|" separator data with value like this
no| value
1| 3,123.00
2| 1,122.75
import it with this code:
library(readr)
data <- read_delim("file.txt", "|", trim_ws = TRUE, locale = locale(decimal_mark = "."), col_types = cols(no = col_double(),
value = col_double()))
Warning: 2 parsing failures.
row col expected actual file
1 value no trailing characters ,123.00 'file.txt'
2 value no trailing characters ,122.75 'file.txt'
This make the data imported to be NA, I already spesified the local to point decimal mark.
Why are my values read like this: ,123.00
?, the first number before comma is missing If i specify col_types
with col_double
. it works without col_types spesified but i really need to specify the col_types