ropensci / weathercan

R package for downloading weather data from Environment and Climate Change Canada
https://docs.ropensci.org/weathercan
GNU General Public License v3.0
102 stars 29 forks source link

Error in validate_key(key) : could not find function "validate_key" #118

Closed juliasunga closed 3 years ago

juliasunga commented 3 years ago

Attempting download data from St. John's International Airport for a wide-range of dates however problem appears regardless of interval or weather station used.

Current Behavior

Instead of downloading data, receive error message "Error in validate_key(key) : could not find function "validate_key"

I then tried installing package "pushoverr" which contains the validate_key function and received the following message: "validate_key() is deprecated. Please use verify_user() or verify_group() instead. PUSHOVER_APP is not set, and application token not provided (see ?pushoverr for details)" and I am prompted to enter an application token.

Steps to Reproduce (for bugs)

  1. library(weathercan)
  2. airport <- weather_dl(station_ids = 50089, start = '2019-12-28', end = '2019-12-31', interval = "hour") "Error in validate_key(key) : could not find function "validate_key"
  3. library(pushoverr)
  4. airport <- weather_dl(station_ids = 50089, start = '2019-12-28', end = '2019-12-31', interval = "hour") "validate_key() is deprecated. Please use verify_user() or verify_group() instead. PUSHOVER_APP is not set, and application token not provided (see ?pushoverr for details)"

Possible Solution

Context

have attempted to manually install functions (dplyr, tidyr, lubridate, util) that are required of the weatherdl function and package cachem as mentioned in a stackexchange with the same error but no improvement. The function validate

Your Environment

[1] C:/Users/J_Sun/Documents/R/win-library/4.0 [2] C:/Program Files/R/R-4.0.5/library

steffilazerte commented 3 years ago

Hi @juliasunga unfortunately I can't replicate this problem on my computer.

Do you get the same problem with the general README example?

weather_dl(station_ids = 51423, start = "2018-02-01", end = "2018-04-15")

# A tibble: 1,776 x 37
   station_name station_id station_operator prov    lat   lon  elev climate_id WMO_id TC_id date      
   <chr>             <dbl> <lgl>            <chr> <dbl> <dbl> <dbl> <chr>      <chr>  <chr> <date>    
 1 KAMLOOPS A        51423 NA               BC     50.7 -120.  345. 1163781    71887  YKA   2018-02-01
 2 KAMLOOPS A        51423 NA               BC     50.7 -120.  345. 1163781    71887  YKA   2018-02-01
 3 KAMLOOPS A        51423 NA               BC     50.7 -120.  345. 1163781    71887  YKA   2018-02-01
 4 KAMLOOPS A        51423 NA               BC     50.7 -120.  345. 1163781    71887  YKA   2018-02-01
 5 KAMLOOPS A        51423 NA               BC     50.7 -120.  345. 1163781    71887  YKA   2018-02-01
 6 KAMLOOPS A        51423 NA               BC     50.7 -120.  345. 1163781    71887  YKA   2018-02-01
 7 KAMLOOPS A        51423 NA               BC     50.7 -120.  345. 1163781    71887  YKA   2018-02-01
 8 KAMLOOPS A        51423 NA               BC     50.7 -120.  345. 1163781    71887  YKA   2018-02-01
 9 KAMLOOPS A        51423 NA               BC     50.7 -120.  345. 1163781    71887  YKA   2018-02-01
10 KAMLOOPS A        51423 NA               BC     50.7 -120.  345. 1163781    71887  YKA   2018-02-01
# … with 1,766 more rows, and 26 more variables: time <dttm>, year <chr>, month <chr>, day <chr>, hour <chr>,
#   weather <chr>, hmdx <dbl>, hmdx_flag <chr>, precip_amt <dbl>, precip_amt_flag <chr>, pressure <dbl>,
#   pressure_flag <chr>, rel_hum <dbl>, rel_hum_flag <chr>, temp <dbl>, temp_dew <dbl>, temp_dew_flag <chr>,
#   temp_flag <chr>, visib <dbl>, visib_flag <chr>, wind_chill <dbl>, wind_chill_flag <chr>, wind_dir <dbl>,
#   wind_dir_flag <chr>, wind_spd <dbl>, wind_spd_flag <chr>
steffilazerte commented 3 years ago

Ah! Actually I expect it's a memoise package issue! Try updating memoise: install.packages("memoise").

I'm currently working on an update to weathercan, so if that works, I'll up the minimum memoise requirement. I think we had this problem reported here a little while ago, but I don't remember...

juliasunga commented 3 years ago

That got it working! Updating memoise followed by updating dplyr did the trick.

Thanks so much for your help! I don't know how I would've figured out that was the problem package on my own.

steffilazerte commented 3 years ago

You got me on the right track because you were clearly looking for the package that had the problematic function... that's what made me think of "keys" (which are used in caching, which is what memoise does!).

Glad to hear it worked out, I'll add this dependency to the next version

steffilazerte commented 3 years ago

I'm actually going to leave this open as a reminder! It shouldn't happen and I can fix it by increasing the minimum version required for memoise.