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
I have the following csv file which has many empty rows. Reading it using readr::read_csv() [and vroom::vroom()] crashed R session whereas base R read.csv() or data.table::fread() did not. I am wondering what the problem was? Thank you!
Reproducible example below
### get sample data filelocation_id<-"ADLC1"test_url<- paste0("https://www.cnrfc.noaa.gov/graphicalRVF_csv.php?id=", location_id)
test_data_file<- file.path(tempdir(), paste0(location_id, ".csv"))
test_data_file
download.file(test_url, test_data_file)
### crashed R
library(readr)
test_data0<- read_csv(test_data_file)
### same issue with vroom
library(vroom)
test_data0<- vroom(test_data_file, delim=",")
### the following codes workedtest_data0<- read.csv(test_data_file) # works
head(test_data0)
#> Issuance.Date.Time..Pacific. Valid.Date.Time..Pacific. Stage..Feet.#> 1 08/30/2023 08:05 AM 08/25/2023 08 AM 0.9#> 2 08/30/2023 08:05 AM 08/25/2023 09 AM 0.9#> 3 08/30/2023 08:05 AM 08/25/2023 10 AM 0.9#> 4 08/30/2023 08:05 AM 08/25/2023 11 AM 0.9#> 5 08/30/2023 08:05 AM 08/25/2023 12 PM 0.9#> 6 08/30/2023 08:05 AM 08/25/2023 01 PM 0.9#> Flow..CFS. Trend Threshold.Exceedance.Status Observed.Forecast#> 1 6 Normal Observed#> 2 7 + Normal Observed#> 3 7 0 Normal Observed#> 4 8 + Normal Observed#> 5 8 + Normal Observed#> 6 8 0 Normal Observed
library(data.table)
test_data0<- fread(test_data_file) # works
head(test_data0)
#> Issuance Date/Time (Pacific) Valid Date/Time (Pacific) Stage (Feet)#> 1: 08/30/2023 08:05 AM 08/25/2023 08 AM 0.9#> 2: 08/30/2023 08:05 AM 08/25/2023 09 AM 0.9#> 3: 08/30/2023 08:05 AM 08/25/2023 10 AM 0.9#> 4: 08/30/2023 08:05 AM 08/25/2023 11 AM 0.9#> 5: 08/30/2023 08:05 AM 08/25/2023 12 PM 0.9#> 6: 08/30/2023 08:05 AM 08/25/2023 01 PM 0.9#> Flow (CFS) Trend Threshold Exceedance Status Observed/Forecast#> 1: 6 Normal Observed#> 2: 7 + Normal Observed#> 3: 7 0 Normal Observed#> 4: 8 + Normal Observed#> 5: 8 + Normal Observed#> 6: 8 0 Normal Observed
I have the following csv file which has many empty rows. Reading it using
readr::read_csv()
[andvroom::vroom()
] crashed R session whereas base Rread.csv()
ordata.table::fread()
did not. I am wondering what the problem was? Thank you!Reproducible example below
Created on 2023-08-31 with reprex v2.0.2
Session info
The text was updated successfully, but these errors were encountered: