openplantpathology / Mungbean_PM

A meta-analysis of mungbean powdery mildew control fungicide efficacy trials
https://openplantpathology.github.io/Mungbean_PM/
Creative Commons Zero v1.0 Universal
1 stars 0 forks source link

02_Preliminary_analysis won't knit #43

Closed adamhsparks closed 3 years ago

adamhsparks commented 3 years ago
Duplicate chunk label 'bwplot', which has been used for the chunk:
PaulMelloy commented 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 = "")
adamhsparks commented 3 years ago
> 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...

PaulMelloy commented 3 years ago

I know its horrible code, but I have been pushed for time. For sure there is a better way to do it

PaulMelloy commented 3 years ago

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) 
adamhsparks commented 3 years ago

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.
PaulMelloy commented 3 years ago

Ok that problem should now be fixed. Want to try again?

adamhsparks commented 3 years ago

thanks, works now