0

I am not able to knit my document in PDF format since I executed the following:

setme <- 
"Sys.setenv(TZ='America/New_York') #some default not get any errors
invisible(loadNamespace('rgeolocate'))
invisible(loadNamespace('httr'))
mytz <- rgeolocate::ip_api(httr::content(httr::GET('https://api.ipify.org?format=json'))[1])[['timezone']]
Sys.setenv(TZ=mytz)"

cat(setme,file=file.path(R.home(),'etc/Rprofile.site'),sep='\n')

from: https://community.rstudio.com/t/rstudio-sys-setenv-does-not-persist/2105/16

In R Markdown, it prints the following message:

Error in loadNamespace("rgeolocate") : 
  there is no package called ‘rgeolocate’
Execution halted

Do you know what is the reason for such message?

I regret having executed these lines. Thank you

QFi
  • 281
  • 1
  • 3
  • 13

1 Answers1

1

Install the rgeolocate package from GitHub rather than from CRAN.

# install developmental version from GitHub
devtools::install_github( repo = "ironholds/rgeolocate" )

Answer for the question partially comes from @Steven Wink from his answer to the question Error in R: (Package which is only available in source form, and may need compilation of C/C++/Fortran) and @Hugues Fontenelle and his answer to the question Error in install.packages : type =="both" cannot be used with 'repos =NULL'.

Cristian E. Nuno
  • 2,822
  • 2
  • 19
  • 33
  • I did, then it prints:`Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘rgeolocate’ Do you want to attempt to install these from sources?` I say yes, but the issue is not fixed. Nothing changes. – QFi Feb 27 '18 at 00:28
  • Does it give you the option to hit 'Y' or 'N'? If so, hit 'Y'. – Cristian E. Nuno Feb 27 '18 at 00:29
  • Yes I hit 'y', but it still shows the same error message. – QFi Feb 27 '18 at 00:30
  • Okay, let me update my answer. Thank you for the quick response. – Cristian E. Nuno Feb 27 '18 at 00:31
  • Since I executed this code `setme <- "Sys.setenv(TZ='America/New_York') invisible(loadNamespace('rgeolocate')) invisible(loadNamespace('httr')) mytz <- rgeolocate::ip_api(httr::content(httr::GET('https://api.ipify.org?format=json'))[1])[['timezone']] Sys.setenv(TZ=mytz)" cat(setme,file=file.path(R.home(),'etc/Rprofile.site'),sep='\n')` from: https://community.rstudio.com/t/rstudio-sys-setenv-does-not-persist/2105/16 I got this error message and not able to knit document anymore. I have so much regret executing these lines. – QFi Feb 27 '18 at 00:37
  • All is definitely not lost. I would recommend reading the comments to the SO post I linked to in my question. It walks you through some behind the scenes tools you may or may not have on your operating system. – Cristian E. Nuno Feb 27 '18 at 00:42
  • Thank you. I tried your solution and printed the following: **Error in install.packages : type == "both" cannot be used with 'repos = NULL'**. – QFi Feb 27 '18 at 00:51
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/165861/discussion-between-aspiringurbandatascientist-and-zizou23). – Cristian E. Nuno Feb 27 '18 at 00:55