File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed
Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,11 @@ get_csv <- function(req, limit) {
137137
138138 if (httr2 :: resp_has_body(resp )) {
139139 return_list <- httr2 :: resp_body_string(resp )
140- df <- data.table :: fread(input = return_list , data.table = FALSE )
140+ df <- data.table :: fread(
141+ input = return_list ,
142+ data.table = FALSE ,
143+ colClasses = " text"
144+ )
141145
142146 included_num_cols <- names(df )[names(df ) %in% num_cols ]
143147
@@ -148,8 +152,10 @@ get_csv <- function(req, limit) {
148152 if (skip_geo ) {
149153 df <- df [, names(df )[! names(df ) %in% c(" x" , " y" )]]
150154 } else {
151- df <- sf :: st_as_sf(df , coords = c(" x" , " y" ))
152- sf :: st_crs(df ) <- 4269
155+ if (all(c(" x" , " y" ) %in% names(df ))) {
156+ df <- sf :: st_as_sf(df , coords = c(" x" , " y" ))
157+ sf :: st_crs(df ) <- 4269
158+ }
153159 }
154160
155161 if (nrow(df ) == limit ) {
Original file line number Diff line number Diff line change @@ -585,6 +585,18 @@ test_that("bad_properties", {
585585 time = c(" 2021-01-01" , " 2022-01-01" ),
586586 properties = c(" value" , " time" , " blah" )
587587 ))
588+
589+ # No paging
590+ dv_data_quick <- read_waterdata_daily(
591+ monitoring_location_id = site ,
592+ parameter_code = " 00060" ,
593+ no_paging = TRUE
594+ )
595+
596+ expect_type(dv_data_quick $ parameter_code , " character" )
597+ expect_is(dv_data_quick $ time , " Date" )
598+ expect_equal(dv_data_quick $ parameter_code [1 ], " 00060" )
599+
588600 # Empty result:
589601 expect_message(read_waterdata_daily(
590602 monitoring_location_id = " USGS-02238500" ,
You can’t perform that action at this time.
0 commit comments