You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## replace x's with nytimes article search API key which## you can acquire by visiting the following URL:## https://developer.nytimes.com/signupapikey<- paste0("NYTIMES_KEY=", "xxxxxxxxxxxxxxxxxxxxxxxxxxxx")
## make path to .Renvironfile<- file.path(path.expand("~"), ".Renviron")
## save environment variable
cat(apikey, file=file, append=TRUE, fill=TRUE)
## get http response objects for search about sanctionsnytsearch<- nyt_search("sanctions", n=2000)
## convert response object to data framenytsearchdf<- as.data.frame(nytsearch)
## preview data
head(nytsearchdf, 10)
Most Popular API
## get data for most popular storiesnytpop<- nyt_mostpopular(metric="mostshared",
section="U.S.")
## convert response object to data framenytpopdf<- as.data.frame(nytpop)
## preview data
head(nytpopdf)
## get media for each observation
get_media(nytpopdf)
Times Newswire API
## get data from the Times newswirenytwire<- nyt_timeswire(src="all",
section="all")
## convert response object to data framenytwiredf<- as.data.frame(nytwire)
## preview data
head(nytwiredf)
About
These functions were created during the Big Dynamic Data working
group sponsored by the Center for Research Methods & Data Analysis
at the University of Kansas.