You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
read_csv(2) doesn't work with decimals which are non-locale, and also on negatives.
Check the following two examples. It's temperature data for Germany. url3 is March, and some months have negative temperatures. Data is imported as character, at least preserving the negatives and decimals. A mutate(column = as.numeric(column)) "fixes" the problem. For month April data (url4), there are no negative temperatures, and the data is imported as numeric, but dropping the decimal (so, 5.6 is converted to 56).
Expected outcome: temperature data should be imported as numeric, with correct decimal and negative values.
url3 <- paste0(
"ftp://ftp-cdc.dwd.de/pub/CDC/",
"regional_averages_DE/monthly/air_temperature_mean/",
"regional_averages_tm_", sprintf("%02i", 3), ".txt"
)
url4 <- paste0(
"ftp://ftp-cdc.dwd.de/pub/CDC/",
"regional_averages_DE/monthly/air_temperature_mean/",
"regional_averages_tm_", sprintf("%02i", 4), ".txt"
)
## note: ignore the parsing warnings, it's the last line that is messing it up. Can be avoided by setting n_max
dd3 <- read_csv2(url3, skip = 1, dec = ".")# temp data is as expected, but as.character(): "x.y"
dd4 <- read_csv2(url4, skip = 1, dec = ".")# temp data is messed up: xxx
I "fixed" it by using read_lines and piping that into read.csv2(text = read_lines(...), dec = ".", ...), so that could be used as a test-case.
The text was updated successfully, but these errors were encountered:
This is probably related to #376, #308, and #358.
read_csv(2) doesn't work with decimals which are non-locale, and also on negatives.
Check the following two examples. It's temperature data for Germany. url3 is March, and some months have negative temperatures. Data is imported as character, at least preserving the negatives and decimals. A
mutate(column = as.numeric(column))
"fixes" the problem. For month April data (url4), there are no negative temperatures, and the data is imported as numeric, but dropping the decimal (so,5.6
is converted to56
).Expected outcome: temperature data should be imported as numeric, with correct decimal and negative values.
I "fixed" it by using
read_lines
and piping that intoread.csv2(text = read_lines(...), dec = ".", ...)
, so that could be used as a test-case.The text was updated successfully, but these errors were encountered: