Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: couldn't find NYTIMES_KEY environment variable #1

Open
ngathan opened this issue Aug 15, 2020 · 2 comments
Open

Error: couldn't find NYTIMES_KEY environment variable #1

ngathan opened this issue Aug 15, 2020 · 2 comments

Comments

@ngathan
Copy link

ngathan commented Aug 15, 2020

I followed the first steps to set up the environment as follows:

apikey <- paste0("NYTIMES_KEY=", "mykey____")
file <- file.path(path.expand("~"), ".Renviron")
cat(apikey, file = file, append = TRUE, fill = TRUE)
install.packages("devtools")
devtools::install_github("mkearney/nytimes")
library(nytimes)
nytsearch <- nyt_search("multiculturalism", n = 2000)

But I got this error: Error: couldn't find NYTIMES_KEY environment variable

What have I done wrong?

@sarahemlin
Copy link

sarahemlin commented Mar 13, 2022

I used Sys.setenv(NYTIMES_KEY="MY-API-KEY") instead of the first 3 lines of code and it worked. I found that suggestion here: https://www.storybench.org/working-with-the-new-york-times-api-in-r/

@ngathan
Copy link
Author

ngathan commented Mar 13, 2022

Thanks @sarahemlin!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants