Closed adamhsparks closed 3 years ago
arg, my bad, parenthesis in the wrong spot
LL <- format(round(PM_MB_dat[1, 21:22],4),nsmall = 4)
paste("weather/", str_remove(paste(LL, collapse = ""),"-"), ".csv", sep = "")
> LL <- format(round(PM_MB_dat[1, 21:22],4),nsmall = 4)
> paste("weather/", str_remove(paste(LL, collapse = ""),"-"), ".csv", sep = "")
[1] "weather/28.2150152.1003.csv"
I'd not be naming files in such a manner that it depends on rounding...
I know its horrible code, but I have been pushed for time. For sure there is a better way to do it
Hi Adam,
I adapted the crop_rain
code so it will not download the same station data more than once if file.exists()
fails.
That said do you want to test the code to see if the amended function works on your computer?
If the file.exists()
function still fails as it was before I may try a different work around like...
file %in% list.files(file.path)
Starting at line 633 it fails.
> source("R/add_lat_longs.R") # code adds the latitude- and longitude to PM_MB_dat
> source("R/crop_rain.R")
> # Obtain rainfall from bomrang
> PM_MB_dat$sum_rain <-
+ crop_rain(location_name = PM_MB_dat$location,
+ latitude = PM_MB_dat$lat,
+ longitude = PM_MB_dat$lon,
+ first_day = PM_MB_dat$planting_date,
+ last_day = PM_MB_dat$harvest_date)
Error: Problem with `mutate()` input `stat_file`.
x object 'stat_file' not found
ℹ Input `stat_file` is `case_when(...)`.
Run `rlang::last_error()` to see where the error occurred.
Ok that problem should now be fixed. Want to try again?
thanks, works now