0

I try to anaylse World Bank climate data using their rWBclimate package. However, no matters what I do, the package is not recognised by my computer. It starts by not completing the first step of the instruction.

require(rWBclimate) results in

Loading required package: rWBclimate Warning message: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, : there is no package called ‘rWBclimate’

and then

Error in find.package(if (is.null(package)) loadedNamespaces() else package, : there is no package called ‘rWBclimate’

There is this case posted, but it doesn't solve my problem

I would appreciate any help. Thank you!

  • You can [install old versions](https://stackoverflow.com/questions/17082341/installing-older-version-of-r-package) of the package with `install.packages("https://cran.r-project.org/src/contrib/Archive/rWBclimate/rWBclimate_0.1.3.tar.gz", repos=NULL, type="source")` which should be okay as it seems as if it was removed due to [notes](https://cran-archive.r-project.org/web/checks/2022/2022-06-20_check_results_rWBclimate.html). – user20650 Mar 16 '23 at 13:38
  • ... But you will need to make sure that you have all the packages lisyted under [imports](https://github.com/ropensci/rWBclimate/blob/master/DESCRIPTION#L16) **before** trying to install – user20650 Mar 16 '23 at 13:38
  • It keeps giving me the same error... –  Mar 16 '23 at 16:03
  • Did you get any error when trying to install? e.g. dd it install correctly or did you get a message on non-zero exit status? – user20650 Mar 16 '23 at 16:04
  • Finally, I managed to install the package, using @Poiu Rewq recommendation. Now, the problem is that ```rWBclimate::get_historical_precip(c("USA","BRA","AUS"), "month") ``` returns an error > Error: lexical error: invalid char in json text. (right here) ------^ From what I see [here](https://github.com/ropensci/rWBclimate/blob/master/R/get_historical_data.R), the function leads to a non-existing website –  Mar 16 '23 at 16:59

1 Answers1

0

To install a package from GitHub you should use install_github() function from devtools package.

Poiu Rewq
  • 182
  • 13
  • Thank you. I got through the first step. First, I apologise if my question is too non-advanced. I am now stuck with >Error: lexical error: invalid char in json text. (right here) ------^ Following some instructions, I already did ```library(jsonlite) # read JSON``` –  Mar 16 '23 at 09:43
  • I don't understand how you got that error and if it's connected to the original question. Could you be more specific? – Poiu Rewq Mar 16 '23 at 09:48
  • I followed the steps, according the instructions. My code is: ```devtools::install_github("ropensci/rWBclimate")``` ```require(rWBclimate) # world bank package ``` ```rWBclimate::get_historical_precip(c("USA","BRA","AUS"), "month") ``` –  Mar 16 '23 at 09:53
  • 1
    I can't tell how the fix the error, but the repo is outdated and I doubt it's maintained. You could try redirect your question there – Poiu Rewq Mar 16 '23 at 11:31