library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.5.1 ✔ tibble 3.2.1
## ✔ lubridate 1.9.4 ✔ tidyr 1.3.1
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(httr)
library(jsonlite)
##
## Attaching package: 'jsonlite'
##
## The following object is masked from 'package:purrr':
##
## flatten
library(readr)
library(tidytext)
## Warning: package 'tidytext' was built under R version 4.4.3
library(ggplot2)
httr: Provides functions for
working with HTTP, making it easy to send GET, POST, and other HTTP
requests.
jsonlite: Offers tools for parsing
JSON data into R objects (like lists or data frames) and converting R
objects into JSON.
Here I’m creating API endpoint
/svc/mostpopular/v2/viewed/1.json for New York
Times most viewed articles for today.
api_key includes API key.
api_key <- Sys.getenv("NYT_API_KEY")
api_url <- paste0("https://api.nytimes.com/svc/mostpopular/v2/viewed/30.json?api-key=", api_key)
response <- GET(api_url)
GET:this function from httrpackage sends
HTTP GET request to the URL defined by
api_url.
The result of the response is stored in response
variable. It includes status information, headers, and the body of the
response.
if(status_code(response) == 200) {
json_data <- content(response, as = "text", encoding = "UTF-8")
data_list <- fromJSON(json_data, flatten = TRUE)
}else {
print("Error: Unable to fetch data from API")
}
status_code(response)retrieves the HTTP status code from
the response.
200: Indicates a successful request. If
the status code is 200, the code proceeds to parse the content.
Otherwise, it prints an error message.
json_data <- content(response, as = "text", encoding = "UTF-8")
data_list <- fromJSON(json_data, flatten = TRUE)
print(data_list)
## $status
## [1] "OK"
##
## $copyright
## [1] "Copyright (c) 2025 The New York Times Company. All Rights Reserved."
##
## $num_results
## [1] 20
##
## $results
## uri
## 1 nyt://article/2180670d-3746-549a-b8c1-aeeb232afbe1
## 2 nyt://article/f6a45e9b-1f77-5f75-b538-3e95c72a5db6
## 3 nyt://article/b831afe8-eda5-53c0-ba24-697237038399
## 4 nyt://article/9e53daea-f06f-537b-b5fc-e629f10eead2
## 5 nyt://article/821e56d6-cc94-56fa-a5ae-624a83a3970b
## 6 nyt://article/65e014a8-04e5-5e31-bf63-b90eb3e761ed
## 7 nyt://interactive/cc2fe106-81ac-57e6-a1b8-9e9e9cdfa3bb
## 8 nyt://article/85520748-1c4e-5b9b-9cbf-0490b5ecf752
## 9 nyt://interactive/0435cd0a-66c7-5cbb-aea9-aa51c7828363
## 10 nyt://article/53b2c41a-06df-55e5-b0db-e339d91eb096
## 11 nyt://article/0b5a36f6-757e-51ab-aa1b-d4de8294eda6
## 12 nyt://article/a7ea33b5-fe5b-5dd0-8bfb-0e80f053feb9
## 13 nyt://article/14662679-9279-5b0e-a86b-4124013d18cb
## 14 nyt://article/cd0c66fd-7767-5885-b4d3-597efd65d1a0
## 15 nyt://article/4564fa7e-ca93-5a1e-9840-00c36c5e839b
## 16 nyt://article/5cfc23ee-a197-5670-8630-74dc44b11891
## 17 nyt://article/057fa44a-cc82-5e3b-837c-cdf7919ccda8
## 18 nyt://article/4bb7adc3-2ee8-5fef-a9b1-2a2ee9538139
## 19 nyt://article/a94e473f-d714-55f8-874c-47a915e33bcc
## 20 nyt://article/ed5ba83d-fed3-5746-863f-3b16b71e3864
## url
## 1 https://www.nytimes.com/2025/03/07/us/politics/trump-musk-doge-power.html
## 2 https://www.nytimes.com/2025/02/27/us/gene-hackman-wife-dead-new-mexico.html
## 3 https://www.nytimes.com/2025/03/14/us/politics/trump-travel-ban.html
## 4 https://www.nytimes.com/2025/03/07/us/gene-hackman-investigation-cause-death.html
## 5 https://www.nytimes.com/2025/03/02/movies/oscars-winners-list.html
## 6 https://www.nytimes.com/2025/03/08/us/gene-hackman-betsy-arakawa.html
## 7 https://www.nytimes.com/interactive/2025/03/07/us/trump-federal-agencies-websites-words-dei.html
## 8 https://www.nytimes.com/2025/03/16/us/brown-university-rasha-alawieh-professor-deported.html
## 9 https://www.nytimes.com/interactive/2025/03/25/us/signal-group-chat-text-annotations.html
## 10 https://www.nytimes.com/2025/03/20/us/politics/musk-pentagon-briefing-china-war-plan.html
## 11 https://www.nytimes.com/2025/03/12/world/europe/musk-email-italy-airbase.html
## 12 https://www.nytimes.com/2025/02/27/obituaries/gene-hackman-dead.html
## 13 https://www.nytimes.com/2025/03/09/arts/merle-oberon-south-asian-hollywood-star.html
## 14 https://www.nytimes.com/article/gene-hackman-death-updates.html
## 15 https://www.nytimes.com/2025/03/14/well/aging-process-getting-older.html
## 16 https://www.nytimes.com/2025/03/10/well/covid-long-term-health-damage.html
## 17 https://www.nytimes.com/2025/03/28/opinion/trump-hegseth-signal-chat.html
## 18 https://www.nytimes.com/2025/03/16/opinion/covid-pandemic-lab-leak.html
## 19 https://www.nytimes.com/2025/03/03/movies/oscars-moments-best-worst.html
## 20 https://www.nytimes.com/2025/03/07/world/canada/trump-trudeau-canada-51st-state.html
## id asset_id source published_date updated section
## 1 1e+14 1e+14 New York Times 2025-03-07 2025-03-17 22:31:28 U.S.
## 2 1e+14 1e+14 New York Times 2025-02-27 2025-02-28 02:36:21 U.S.
## 3 1e+14 1e+14 New York Times 2025-03-14 2025-03-18 03:31:59 U.S.
## 4 1e+14 1e+14 New York Times 2025-03-07 2025-03-08 00:15:12 U.S.
## 5 1e+14 1e+14 New York Times 2025-03-02 2025-03-03 22:29:44 Movies
## 6 1e+14 1e+14 New York Times 2025-03-08 2025-03-09 23:10:32 U.S.
## 7 1e+14 1e+14 New York Times 2025-03-07 2025-03-08 12:05:47 U.S.
## 8 1e+14 1e+14 New York Times 2025-03-16 2025-03-17 10:52:16 U.S.
## 9 1e+14 1e+14 New York Times 2025-03-25 2025-03-28 17:34:57 U.S.
## 10 1e+14 1e+14 New York Times 2025-03-20 2025-03-21 14:59:26 U.S.
## 11 1e+14 1e+14 New York Times 2025-03-12 2025-03-15 22:51:35 World
## 12 1e+14 1e+14 New York Times 2025-02-27 2025-03-07 17:09:11 Obituaries
## 13 1e+14 1e+14 New York Times 2025-03-09 2025-03-20 14:13:14 Arts
## 14 1e+14 1e+14 New York Times 2025-02-28 2025-03-17 16:27:32 U.S.
## 15 1e+14 1e+14 New York Times 2025-03-14 2025-03-15 12:47:50 Well
## 16 1e+14 1e+14 New York Times 2025-03-10 2025-03-12 20:47:46 Well
## 17 1e+14 1e+14 New York Times 2025-03-28 2025-03-28 21:02:29 Opinion
## 18 1e+14 1e+14 New York Times 2025-03-16 2025-03-18 04:40:28 Opinion
## 19 1e+14 1e+14 New York Times 2025-03-03 2025-03-04 08:44:54 Movies
## 20 1e+14 1e+14 New York Times 2025-03-07 2025-03-24 06:48:54 World
## subsection nytdsection
## 1 Politics u.s.
## 2 u.s.
## 3 Politics u.s.
## 4 u.s.
## 5 movies
## 6 u.s.
## 7 u.s.
## 8 u.s.
## 9 u.s.
## 10 Politics u.s.
## 11 Europe world
## 12 obituaries
## 13 arts
## 14 u.s.
## 15 well
## 16 well
## 17 opinion
## 18 opinion
## 19 movies
## 20 Canada world
## adx_keywords
## 1 United States Politics and Government;Government Employees;Layoffs and Job Reductions;Trump, Donald J;Rubio, Marco;Duffy, Sean P;Collins, Douglas A (1966- );Musk, Elon;State Department;Federal Aviation Administration;Veterans Affairs Department;Government Efficiency Department (US)
## 2 Actors and Actresses;Deaths (Fatalities);Hackman, Gene;Arakawa, Betsy (1959-2025);New Mexico;Santa Fe (NM)
## 3 United States International Relations;Executive Orders and Memorandums;Terrorism;Immigration and Emigration;Visas;Diplomatic Service, Embassies and Consulates;Travel Warnings;Trump, Donald J;State Department
## 4 Deaths (Fatalities);Hackman, Gene;Arakawa, Betsy (1959-2025);Santa Fe (NM)
## 5 Academy Awards (Oscars);Movies
## 6 Deaths (Fatalities);Content Type: Personal Profile;Arakawa, Betsy (1959-2025);Hackman, Gene;Santa Fe (NM)
## 7 United States Politics and Government;Executive Orders and Memorandums;Diversity Initiatives;Trump, Donald J
## 8 Deportation;Foreign Workers;Suits and Litigation (Civil);Decisions and Verdicts;Surgery and Surgeons;Visas;Alawieh, Rasha;Brown University;Customs and Border Protection (US);Homeland Security Department;Logan International Airport (Boston, Mass);Lebanon;Boston (Mass)
## 9 Signal Chat Leak (Trump Administration);United States Defense and Military Forces;Classified Information and State Secrets;United States Politics and Government;War and Armed Conflicts;Hegseth, Pete;Trump, Donald J;Waltz, Michael (1974- );Vance, J D;Rubio, Marco;Kent, Joe (1980- );Ratcliffe, John Lee (1965- );Bessent, Scott;Wiles, Susie;Gabbard, Tulsi (1981- );Witkoff, Steven;Miller, Stephen (1985- );Goldberg, Jeffrey;Signal (Open Whisper Systems);Atlantic Monthly;Defense Department;Houthis;Yemen
## 10 Classified Information and State Secrets;Conflicts of Interest;United States Defense and Military Forces;United States International Relations;United States Politics and Government;Musk, Elon;Trump, Donald J;Hegseth, Pete;Government Efficiency Department (US);Space Exploration Technologies Corp;Defense Department;China
## 11 Government Employees;Labor and Jobs;Military Bases and Installations;Organized Labor;United States Defense and Military Forces;International Relations;Musk, Elon;Trump, Donald J;Defense Department;Government Efficiency Department (US);United States Army;Italy;Aviano Air Base (Italy);Aviano (Italy)
## 12 Deaths (Obituaries);Actors and Actresses;Movies;Academy Awards (Oscars);Hackman, Gene
## 13 Actors and Actresses;Content Type: Personal Profile;Asian-Americans;Indian-Americans;Race and Ethnicity;Discrimination;Academy Awards (Oscars);Books and Literature;internal-open-access;Oberon, Merle;Sen, Mayukh
## 14 Deaths (Fatalities);Hackman, Gene;Arakawa, Betsy (1959-2025);Santa Fe (NM)
## 15 Age, Chronological;Elderly;Content Type: Service;Teeth and Dentistry;Bones;Voice and Speech;Height (Stature);Migraine Headaches
## 16 Long Covid;Coronavirus (2019-nCoV);Heart;Brain;Research
## 17 United States International Relations;United States Politics and Government;Signal Chat Leak (Trump Administration);Classified Information and State Secrets;Trump, Donald J;Clinton, Hillary Rodham;Hegseth, Pete;Obama, Barack;State Department
## 18 Coronavirus Origins Investigation;Research;Laboratories and Scientific Equipment;Coronavirus (2019-nCoV);Epidemics;Academic and Scientific Journals;Ethics and Official Misconduct;Daszak, Peter;Andersen, Kristian G;McNeil, Donald G Jr;Cell (Journal);EcoHealth Alliance;Lancet, The (Journal);Nature Medicine (Journal);Wuhan Institute of Virology (China);Wuhan (China)
## 19 Movies;Academy Awards (Oscars);Actors and Actresses;Abraham, Yuval (1995- );Adra, Basel;Baker, Sean (1971- );Culkin, Kieran;Erivo, Cynthia;Grande, Ariana;Madison, Mikey (1999- );O'Brien, Conan
## 20 United States International Relations;Territorial Disputes;Treaties;Customs (Tariff);International Trade and World Market;United States Politics and Government;Trudeau, Justin;Trump, Donald J;Canada;Great Lakes
## column
## 1 NA
## 2 NA
## 3 NA
## 4 NA
## 5 NA
## 6 NA
## 7 NA
## 8 NA
## 9 NA
## 10 NA
## 11 NA
## 12 NA
## 13 NA
## 14 NA
## 15 NA
## 16 NA
## 17 NA
## 18 NA
## 19 NA
## 20 NA
## byline
## 1 By Jonathan Swan and Maggie Haberman
## 2 By Julia Jacobs and Ali Watkins
## 3 By Charlie Savage, Ken Bensinger and Allison McCann
## 4 By Nicholas Bogel-Burroughs and Julia Jacobs
## 5 By Shivani Gonzalez
## 6 By Nicholas Bogel-Burroughs, Julia Jacobs and Richard Fausset
## 7 By Karen Yourish, Annie Daniel, Saurabh Datar, Isaac White and Lazaro Gamio
## 8 By Dana Goldstein
## 9
## 10 By Eric Schmitt, Eric Lipton, Julian E. Barnes, Ryan Mac and Maggie Haberman
## 11 By Emma Bubola
## 12 By Robert Berkvist
## 13 By Anna Kodé
## 14 By Alexandra E. Petri, Jonathan Wolfe and Michael Levenson
## 15 By Jancee Dunn
## 16 By Dani Blum, Nina Agrawal and Alice Callahan
## 17 By Hillary Clinton
## 18 By Zeynep Tufekci
## 19 By The New York Times
## 20 By Matina Stevis-Gridneff
## type
## 1 Article
## 2 Article
## 3 Article
## 4 Article
## 5 Article
## 6 Article
## 7 Interactive
## 8 Article
## 9 Interactive
## 10 Article
## 11 Article
## 12 Article
## 13 Article
## 14 Article
## 15 Article
## 16 Article
## 17 Article
## 18 Article
## 19 Article
## 20 Article
## title
## 1 Inside the Explosive Meeting Where Trump Officials Clashed With Elon Musk
## 2 Scattered Pills Found Near Body of Hackman’s Wife as Inquiry Continues
## 3 Draft List for New Travel Ban Proposes Trump Target 43 Countries
## 4 Gene Hackman Died a Week After His Wife, Both From Natural Causes
## 5 Oscars 2025 Winners: Full List
## 6 A Haunting Coda: The 7 Days Gene Hackman’s Wife Could No Longer Care for Him
## 7 These Words Are Disappearing in the New Trump Administration
## 8 Brown University Professor Is Deported Despite a Judge’s Order
## 9 The Leaked Signal Chat, Annotated
## 10 Pentagon Set Up Briefing for Musk on Potential War With China
## 11 Musk Email Reaches Italian Workers. It Did Not Go Well.
## 12 Gene Hackman, Hollywood’s Consummate Everyman, Dies at 95
## 13 A Hollywood Star With a Secret That Could Have Ended Her Career
## 14 What We Know About Gene Hackman’s Death
## 15 4 Weird Signs You’re Getting Older
## 16 A Clearer Picture of Covid’s Lasting Effects on the Body
## 17 Hillary Clinton: How Much Dumber Will This Get?
## 18 We Were Badly Misled About the Event That Changed Our Lives
## 19 Best and Worst Moments From the 2025 Oscars
## 20 How Trump’s ‘51st State’ Canada Talk Came to Be Seen as Deadly Serious
## abstract
## 1 Simmering anger at the billionaire’s unchecked power spilled out in a remarkable Cabinet Room meeting. The president quickly moved to rein in Mr. Musk.
## 2 The sheriff’s office in Santa Fe County, N.M., is investigating after the actor Gene Hackman, his wife and one of their dogs were found dead inside their home.
## 3 A draft circulating inside the administration lists three tiers of countries whose citizens may face restrictions on entering the United States.
## 4 The actor’s wife, Betsy Arakawa, died of a respiratory illness linked to rodents, New Mexico officials said. Mr. Hackman had Alzheimer’s, which contributed to his death from heart disease.
## 5 The complete list of winners at the 97th annual Academy Awards.
## 6 The exact details may never be known, but Mr. Hackman, 95 with advanced Alzheimer’s, was alone for about a week after his wife and sole caregiver died.
## 7 Federal agencies have issued guidance to employees on hundreds of terms to limit or avoid using. An analysis of government websites shows many of the same words being removed.
## 8 Dr. Rasha Alawieh, a kidney transplant specialist and Brown University professor who had a valid visa, was expelled in apparent defiance of a court order.
## 9 The chat’s contents, which were obtained by The Atlantic after its editor in chief was added to the Signal group, provide a revealing look at private conversations between top Trump administration officials.
## 10 The access would be a major expansion of Elon Musk’s government role and highlight his conflicts of interest.
## 11 Employees at the Aviano Air Base who serve American forces got a familiar demand to list their achievements. Unions say Italy “is not the Wild West like the U.S.”
## 12 The winner of two Oscars, he was hailed for his nuanced performances in films like “The French Connection,” “Unforgiven” and “The Royal Tenenbaums.”
## 13 Merle Oberon was a popular actress who was once nominated for an Oscar. But a fact that she hid from the public threatened to unspool her entire life’s work.
## 14 New Mexico’s medical examiner said it was likely Mr. Hackman had died around Feb. 18, and that his wife, Betsy Arakawa, died around Feb. 11.
## 15 We asked experts about what’s normal — and what’s not.
## 16 Five years on, scientists are starting to understand how the virus can lead to long-term, sometimes invisible changes.
## 17 The Signal group chat is only the latest in a string of self-inflicted wounds by the new administration.
## 18 Five years after the start of Covid, we still don’t know the truth.
## 19 There was plenty to take in, including a “Wicked” opener, Conan O’Brien gags, and memorable speeches both good and bad. And people watching on Hulu saw almost all of it.
## 20 President Trump, in an early February call, challenged the border treaty between the two countries and told Justin Trudeau he didn’t like their shared water agreements.
## des_facet
## 1 United States Politics and Government, Government Employees, Layoffs and Job Reductions
## 2 Actors and Actresses, Deaths (Fatalities)
## 3 United States International Relations, Executive Orders and Memorandums, Terrorism, Immigration and Emigration, Visas, Diplomatic Service, Embassies and Consulates, Travel Warnings
## 4 Deaths (Fatalities)
## 5 Academy Awards (Oscars), Movies
## 6 Deaths (Fatalities), Content Type: Personal Profile
## 7 United States Politics and Government, Executive Orders and Memorandums, Diversity Initiatives
## 8 Deportation, Foreign Workers, Suits and Litigation (Civil), Decisions and Verdicts, Surgery and Surgeons, Visas
## 9 Signal Chat Leak (Trump Administration), United States Defense and Military Forces, Classified Information and State Secrets, United States Politics and Government, War and Armed Conflicts
## 10 Classified Information and State Secrets, Conflicts of Interest, United States Defense and Military Forces, United States International Relations, United States Politics and Government
## 11 Government Employees, Labor and Jobs, Military Bases and Installations, Organized Labor, United States Defense and Military Forces, International Relations
## 12 Deaths (Obituaries), Actors and Actresses, Movies, Academy Awards (Oscars)
## 13 Actors and Actresses, Content Type: Personal Profile, Asian-Americans, Indian-Americans, Race and Ethnicity, Discrimination, Academy Awards (Oscars), Books and Literature, internal-open-access
## 14 Deaths (Fatalities)
## 15 Age, Chronological, Elderly, Content Type: Service, Teeth and Dentistry, Bones, Voice and Speech, Height (Stature), Migraine Headaches
## 16 Long Covid, Coronavirus (2019-nCoV), Heart, Brain, Research
## 17 United States International Relations, United States Politics and Government, Signal Chat Leak (Trump Administration), Classified Information and State Secrets
## 18 Coronavirus Origins Investigation, Research, Laboratories and Scientific Equipment, Coronavirus (2019-nCoV), Epidemics, Academic and Scientific Journals, Ethics and Official Misconduct
## 19 Movies, Academy Awards (Oscars), Actors and Actresses
## 20 United States International Relations, Territorial Disputes, Treaties, Customs (Tariff), International Trade and World Market, United States Politics and Government
## org_facet
## 1 State Department, Federal Aviation Administration, Veterans Affairs Department, Government Efficiency Department (US)
## 2
## 3 State Department
## 4
## 5
## 6
## 7
## 8 Brown University, Customs and Border Protection (US), Homeland Security Department, Logan International Airport (Boston, Mass)
## 9 Signal (Open Whisper Systems), Atlantic Monthly, Defense Department, Houthis
## 10 Government Efficiency Department (US), Space Exploration Technologies Corp, Defense Department
## 11 Defense Department, Government Efficiency Department (US), United States Army
## 12
## 13
## 14
## 15
## 16
## 17 State Department
## 18 Cell (Journal), EcoHealth Alliance, Lancet, The (Journal), Nature Medicine (Journal), Wuhan Institute of Virology (China)
## 19
## 20
## per_facet
## 1 Trump, Donald J, Rubio, Marco, Duffy, Sean P, Collins, Douglas A (1966- ), Musk, Elon
## 2 Hackman, Gene, Arakawa, Betsy (1959-2025)
## 3 Trump, Donald J
## 4 Hackman, Gene, Arakawa, Betsy (1959-2025)
## 5
## 6 Arakawa, Betsy (1959-2025), Hackman, Gene
## 7 Trump, Donald J
## 8 Alawieh, Rasha
## 9 Hegseth, Pete, Trump, Donald J, Waltz, Michael (1974- ), Vance, J D, Rubio, Marco, Kent, Joe (1980- ), Ratcliffe, John Lee (1965- ), Bessent, Scott, Wiles, Susie, Gabbard, Tulsi (1981- ), Witkoff, Steven, Miller, Stephen (1985- ), Goldberg, Jeffrey
## 10 Musk, Elon, Trump, Donald J, Hegseth, Pete
## 11 Musk, Elon, Trump, Donald J
## 12 Hackman, Gene
## 13 Oberon, Merle, Sen, Mayukh
## 14 Hackman, Gene, Arakawa, Betsy (1959-2025)
## 15
## 16
## 17 Trump, Donald J, Clinton, Hillary Rodham, Hegseth, Pete, Obama, Barack
## 18 Daszak, Peter, Andersen, Kristian G, McNeil, Donald G Jr
## 19 Abraham, Yuval (1995- ), Adra, Basel, Baker, Sean (1971- ), Culkin, Kieran, Erivo, Cynthia, Grande, Ariana, Madison, Mikey (1999- ), O'Brien, Conan
## 20 Trudeau, Justin, Trump, Donald J
## geo_facet
## 1
## 2 New Mexico, Santa Fe (NM)
## 3
## 4 Santa Fe (NM)
## 5
## 6 Santa Fe (NM)
## 7
## 8 Lebanon, Boston (Mass)
## 9 Yemen
## 10 China
## 11 Italy, Aviano Air Base (Italy), Aviano (Italy)
## 12
## 13
## 14 Santa Fe (NM)
## 15
## 16
## 17
## 18 Wuhan (China)
## 19
## 20 Canada, Great Lakes
## media
## 1 image, photo, Cabinet officials generally like the concept of what Elon Musk set out to do — reducing waste, fraud and abuse in government — but have been frustrated by the hacksaw approach to upending the government and the lack of consistent coordination., Pete Marovich for The New York Times, 1, https://static01.nyt.com/images/2025/03/07/multimedia/07dc-trump-musk-zqgm/07dc-trump-musk-zqgm-thumbStandard.jpg, https://static01.nyt.com/images/2025/03/07/multimedia/07dc-trump-musk-zqgm/07dc-trump-musk-zqgm-mediumThreeByTwo210-v2.jpg, https://static01.nyt.com/images/2025/03/07/multimedia/07dc-trump-musk-zqgm/07dc-trump-musk-zqgm-mediumThreeByTwo440-v2.jpg, Standard Thumbnail, mediumThreeByTwo210, mediumThreeByTwo440, 75, 140, 293, 75, 210, 440
## 2 NULL
## 3 image, photo, The most stringent restriction level would flatly bar citizens from 11 countries from entering the United States., Ian Willms for The New York Times, 1, https://static01.nyt.com/images/2025/03/14/multimedia/14dc-travel-ban-topart-whmt/14dc-travel-ban-topart-whmt-thumbStandard.jpg, https://static01.nyt.com/images/2025/03/14/multimedia/14dc-travel-ban-topart-whmt/14dc-travel-ban-topart-whmt-mediumThreeByTwo210.jpg, https://static01.nyt.com/images/2025/03/14/multimedia/14dc-travel-ban-topart-whmt/14dc-travel-ban-topart-whmt-mediumThreeByTwo440.jpg, Standard Thumbnail, mediumThreeByTwo210, mediumThreeByTwo440, 75, 140, 293, 75, 210, 440
## 4 image, photo, Gene Hackman and his wife, Betsy Arakawa, at the Academy Awards in Los Angeles in 1989. They were found dead at their New Mexico home in late February., Ralph Dominguez/MediaPunch/IPX, via AP, 0, https://static01.nyt.com/images/2025/03/07/multimedia/07nat-hackman-investigation-fmtq/07nat-hackman-investigation-fmtq-thumbStandard.jpg, https://static01.nyt.com/images/2025/03/07/multimedia/07nat-hackman-investigation-fmtq/07nat-hackman-investigation-fmtq-mediumThreeByTwo210.jpg, https://static01.nyt.com/images/2025/03/07/multimedia/07nat-hackman-investigation-fmtq/07nat-hackman-investigation-fmtq-mediumThreeByTwo440.jpg, Standard Thumbnail, mediumThreeByTwo210, mediumThreeByTwo440, 75, 140, 293, 75, 210, 440
## 5 image, photo, Adrien Brody, left, won best actor and Mikey Madison, right, won best actress at the 97th Academy Awards., Philip Cheung for The New York Times, 1, https://static01.nyt.com/images/2025/03/02/arts/02oscars-winners-list-combo/02oscars-winners-list-combo-thumbStandard-v2.jpg, https://static01.nyt.com/images/2025/03/02/arts/02oscars-winners-list-combo/02oscars-winners-list-combo-mediumThreeByTwo210-v3.jpg, https://static01.nyt.com/images/2025/03/02/arts/02oscars-winners-list-combo/02oscars-winners-list-combo-mediumThreeByTwo440-v3.jpg, Standard Thumbnail, mediumThreeByTwo210, mediumThreeByTwo440, 75, 140, 293, 75, 210, 440
## 6 image, photo, Betsy Arakawa and Gene Hackman at the Academy Awards in 1989. They married in 1991 and settled in Santa Fe, N.M., Ralph Dominguez/MediaPunch/IPX, via AP, 0, https://static01.nyt.com/images/2025/03/08/multimedia/08nat-hackman-death-03-fbwh/08nat-hackman-death-03-fbwh-thumbStandard.jpg, https://static01.nyt.com/images/2025/03/08/multimedia/08nat-hackman-death-03-fbwh/08nat-hackman-death-03-fbwh-mediumThreeByTwo210.jpg, https://static01.nyt.com/images/2025/03/08/multimedia/08nat-hackman-death-03-fbwh/08nat-hackman-death-03-fbwh-mediumThreeByTwo440.jpg, Standard Thumbnail, mediumThreeByTwo210, mediumThreeByTwo440, 75, 140, 293, 75, 210, 440
## 7 image, , , The New York Times, 1, https://static01.nyt.com/images/2025/03/07/multimedia/2025-02-28-trump-admin-words-index/2025-02-28-trump-admin-words-index-thumbStandard.png, https://static01.nyt.com/images/2025/03/07/multimedia/2025-02-28-trump-admin-words-index/2025-02-28-trump-admin-words-index-mediumThreeByTwo210.png, https://static01.nyt.com/images/2025/03/07/multimedia/2025-02-28-trump-admin-words-index/2025-02-28-trump-admin-words-index-mediumThreeByTwo440.png, Standard Thumbnail, mediumThreeByTwo210, mediumThreeByTwo440, 75, 140, 293, 75, 210, 440
## 8 image, photo, The Brown University campus in Providence, R.I., Ian MacLellan for The New York Times, 1, https://static01.nyt.com/images/2025/03/16/multimedia/16nat-doc-deported-1-tlwp/16nat-doc-deported-1-tlwp-thumbStandard.jpg, https://static01.nyt.com/images/2025/03/16/multimedia/16nat-doc-deported-1-tlwp/16nat-doc-deported-1-tlwp-mediumThreeByTwo210.jpg, https://static01.nyt.com/images/2025/03/16/multimedia/16nat-doc-deported-1-tlwp/16nat-doc-deported-1-tlwp-mediumThreeByTwo440.jpg, Standard Thumbnail, mediumThreeByTwo210, mediumThreeByTwo440, 75, 140, 293, 75, 210, 440
## 9 image, , , The New York Times, 1, https://static01.nyt.com/images/2025/03/25/multimedia/2025-03-25-atlantic-signal-leak-annotation-index/2025-03-25-atlantic-signal-leak-annotation-index-thumbStandard-v5.jpg, https://static01.nyt.com/images/2025/03/25/multimedia/2025-03-25-atlantic-signal-leak-annotation-index/2025-03-25-atlantic-signal-leak-annotation-index-mediumThreeByTwo210-v5.jpg, https://static01.nyt.com/images/2025/03/25/multimedia/2025-03-25-atlantic-signal-leak-annotation-index/2025-03-25-atlantic-signal-leak-annotation-index-mediumThreeByTwo440-v5.jpg, Standard Thumbnail, mediumThreeByTwo210, mediumThreeByTwo440, 75, 140, 293, 75, 210, 440
## 10 image, photo, President Trump with Elon Musk and Mr. Musk’s son X, at the White House this month. It is unclear what the reasoning is for providing Mr. Musk such a sensitive briefing., Doug Mills/The New York Times, 1, https://static01.nyt.com/images/2025/03/20/multimedia/20dc-musk-pentagon-hqpg/20dc-musk-pentagon-hqpg-thumbStandard.jpg, https://static01.nyt.com/images/2025/03/20/multimedia/20dc-musk-pentagon-hqpg/20dc-musk-pentagon-hqpg-mediumThreeByTwo210.jpg, https://static01.nyt.com/images/2025/03/20/multimedia/20dc-musk-pentagon-hqpg/20dc-musk-pentagon-hqpg-mediumThreeByTwo440.jpg, Standard Thumbnail, mediumThreeByTwo210, mediumThreeByTwo440, 75, 140, 293, 75, 210, 440
## 11 image, photo, Elon Musk arriving at President Trump’s address to Congress last week., Haiyun Jiang for The New York Times, 1, https://static01.nyt.com/images/2025/03/11/multimedia/11italy-doge-01-jzhg/11italy-doge-01-jzhg-thumbStandard.jpg, https://static01.nyt.com/images/2025/03/11/multimedia/11italy-doge-01-jzhg/11italy-doge-01-jzhg-mediumThreeByTwo210.jpg, https://static01.nyt.com/images/2025/03/11/multimedia/11italy-doge-01-jzhg/11italy-doge-01-jzhg-mediumThreeByTwo440.jpg, Standard Thumbnail, mediumThreeByTwo210, mediumThreeByTwo440, 75, 140, 293, 75, 210, 440
## 12 image, photo, Gene Hackman in 1973. If the critics had one word for Mr. Hackman as a performer, it was “believable.”, Evening Standard/Getty Images, 1, https://static01.nyt.com/images/2020/09/24/obituaries/00Hackman1/00Hackman1-thumbStandard.jpg, https://static01.nyt.com/images/2020/09/24/obituaries/00Hackman1/00Hackman1-mediumThreeByTwo210.jpg, https://static01.nyt.com/images/2020/09/24/obituaries/00Hackman1/00Hackman1-mediumThreeByTwo440.jpg, Standard Thumbnail, mediumThreeByTwo210, mediumThreeByTwo440, 75, 140, 293, 75, 210, 440
## 13 image, photo, Among her notable roles was Kitty in “The Dark Angel,” for which she was nominated for an Academy Award for best actress., Everett Collection, 0, https://static01.nyt.com/images/2025/03/19/multimedia/00merle-oberon-kwbt/00merle-oberon-kwbt-thumbStandard.jpg, https://static01.nyt.com/images/2025/03/19/multimedia/00merle-oberon-kwbt/00merle-oberon-kwbt-mediumThreeByTwo210.jpg, https://static01.nyt.com/images/2025/03/19/multimedia/00merle-oberon-kwbt/00merle-oberon-kwbt-mediumThreeByTwo440.jpg, Standard Thumbnail, mediumThreeByTwo210, mediumThreeByTwo440, 75, 140, 293, 75, 210, 440
## 14 image, photo, The house owned by actor Gene Hackman and his wife, Betsy Arakawa., Roberto E. Rosales/Associated Press, 1, https://static01.nyt.com/images/2025/02/28/multimedia/28xp-hackman-wwk-htpg/28xp-hackman-wwk-htpg-thumbStandard.jpg, https://static01.nyt.com/images/2025/02/28/multimedia/28xp-hackman-wwk-htpg/28xp-hackman-wwk-htpg-mediumThreeByTwo210.jpg, https://static01.nyt.com/images/2025/02/28/multimedia/28xp-hackman-wwk-htpg/28xp-hackman-wwk-htpg-mediumThreeByTwo440.jpg, Standard Thumbnail, mediumThreeByTwo210, mediumThreeByTwo440, 75, 140, 293, 75, 210, 440
## 15 image, photo, , Matt Chase, 0, https://static01.nyt.com/images/2025/03/14/well/14WELL-NL-BODYAGES-image/14WELL-NL-BODYAGES-image-thumbStandard.jpg, https://static01.nyt.com/images/2025/03/14/well/14WELL-NL-BODYAGES-image/14WELL-NL-BODYAGES-image-mediumThreeByTwo210.jpg, https://static01.nyt.com/images/2025/03/14/well/14WELL-NL-BODYAGES-image/14WELL-NL-BODYAGES-image-mediumThreeByTwo440.jpg, Standard Thumbnail, mediumThreeByTwo210, mediumThreeByTwo440, 75, 140, 293, 75, 210, 440
## 16 image, photo, , Ibrahim Rayintakath, 0, https://static01.nyt.com/images/2025/03/11/well/10WELL-COVID-BODY-Opener/10WELL-COVID-BODY-Opener-thumbStandard-v3.jpg, https://static01.nyt.com/images/2025/03/11/well/10WELL-COVID-BODY-Opener/10WELL-COVID-BODY-Opener-mediumThreeByTwo210-v2.jpg, https://static01.nyt.com/images/2025/03/11/well/10WELL-COVID-BODY-Opener/10WELL-COVID-BODY-Opener-mediumThreeByTwo440-v2.jpg, Standard Thumbnail, mediumThreeByTwo210, mediumThreeByTwo440, 75, 140, 293, 75, 210, 440
## 17 image, photo, , Haiyun Jiang for The New York Times, 1, https://static01.nyt.com/images/2025/03/28/multimedia/28clinton1-vkzp/28clinton1-vkzp-thumbStandard.jpg, https://static01.nyt.com/images/2025/03/28/multimedia/28clinton1-vkzp/28clinton1-vkzp-mediumThreeByTwo210.jpg, https://static01.nyt.com/images/2025/03/28/multimedia/28clinton1-vkzp/28clinton1-vkzp-mediumThreeByTwo440.jpg, Standard Thumbnail, mediumThreeByTwo210, mediumThreeByTwo440, 75, 140, 293, 75, 210, 440
## 18 image, photo, , Ariana Drehsler/Agence France-Presse — Getty Images, 1, https://static01.nyt.com/images/2025/03/17/multimedia/16tufekci-bqkj/16tufekci-bqkj-thumbStandard-v2.jpg, https://static01.nyt.com/images/2025/03/17/multimedia/16tufekci-bqkj/16tufekci-bqkj-mediumThreeByTwo210-v2.jpg, https://static01.nyt.com/images/2025/03/17/multimedia/16tufekci-bqkj/16tufekci-bqkj-mediumThreeByTwo440-v2.jpg, Standard Thumbnail, mediumThreeByTwo210, mediumThreeByTwo440, 75, 140, 293, 75, 210, 440
## 19 image, photo, Cynthia Erivo and Ariana Grande kicked off the ceremony., Philip Cheung for The New York Times, 1, https://static01.nyt.com/images/2025/03/04/multimedia/02oscars-best-worst-start-mjpc/02oscars-best-worst-start-mjpc-thumbStandard.jpg, https://static01.nyt.com/images/2025/03/04/multimedia/02oscars-best-worst-start-mjpc/02oscars-best-worst-start-mjpc-mediumThreeByTwo210.jpg, https://static01.nyt.com/images/2025/03/04/multimedia/02oscars-best-worst-start-mjpc/02oscars-best-worst-start-mjpc-mediumThreeByTwo440.jpg, Standard Thumbnail, mediumThreeByTwo210, mediumThreeByTwo440, 75, 140, 293, 75, 210, 440
## 20 image, photo, Canadian officials went from thinking Mr. Trump was joking when he referred to Canada as “the 51st state” to fearing he was very serious., Jason Redmond/Agence France-Presse — Getty Images, 1, https://static01.nyt.com/images/2025/03/07/multimedia/07trump-trudeau-pftg/07trump-trudeau-pftg-thumbStandard.jpg, https://static01.nyt.com/images/2025/03/07/multimedia/07trump-trudeau-pftg/07trump-trudeau-pftg-mediumThreeByTwo210.jpg, https://static01.nyt.com/images/2025/03/07/multimedia/07trump-trudeau-pftg/07trump-trudeau-pftg-mediumThreeByTwo440.jpg, Standard Thumbnail, mediumThreeByTwo210, mediumThreeByTwo440, 75, 140, 293, 75, 210, 440
## eta_id
## 1 0
## 2 0
## 3 0
## 4 0
## 5 0
## 6 0
## 7 0
## 8 0
## 9 0
## 10 0
## 11 0
## 12 0
## 13 0
## 14 0
## 15 0
## 16 0
## 17 0
## 18 0
## 19 0
## 20 0
Here the code extracts the body of response as a text string.
UTF-8ensures that characters are correctly
interpreted.
fromJSONconverts the JSON text into
data_listusing jsonlite.
articles_df <- as.data.frame(data_list$results)
The API’s JSON response typically contains a key called
results where the actual articles or items are stored.
glimpse(articles_df)
## Rows: 20
## Columns: 22
## $ uri <chr> "nyt://article/2180670d-3746-549a-b8c1-aeeb232afbe1", "…
## $ url <chr> "https://www.nytimes.com/2025/03/07/us/politics/trump-m…
## $ id <dbl> 1e+14, 1e+14, 1e+14, 1e+14, 1e+14, 1e+14, 1e+14, 1e+14,…
## $ asset_id <dbl> 1e+14, 1e+14, 1e+14, 1e+14, 1e+14, 1e+14, 1e+14, 1e+14,…
## $ source <chr> "New York Times", "New York Times", "New York Times", "…
## $ published_date <chr> "2025-03-07", "2025-02-27", "2025-03-14", "2025-03-07",…
## $ updated <chr> "2025-03-17 22:31:28", "2025-02-28 02:36:21", "2025-03-…
## $ section <chr> "U.S.", "U.S.", "U.S.", "U.S.", "Movies", "U.S.", "U.S.…
## $ subsection <chr> "Politics", "", "Politics", "", "", "", "", "", "", "Po…
## $ nytdsection <chr> "u.s.", "u.s.", "u.s.", "u.s.", "movies", "u.s.", "u.s.…
## $ adx_keywords <chr> "United States Politics and Government;Government Emplo…
## $ column <lgl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
## $ byline <chr> "By Jonathan Swan and Maggie Haberman", "By Julia Jacob…
## $ type <chr> "Article", "Article", "Article", "Article", "Article", …
## $ title <chr> "Inside the Explosive Meeting Where Trump Officials Cla…
## $ abstract <chr> "Simmering anger at the billionaire’s unchecked power s…
## $ des_facet <list> <"United States Politics and Government", "Government …
## $ org_facet <list> <"State Department", "Federal Aviation Administration"…
## $ per_facet <list> <"Trump, Donald J", "Rubio, Marco", "Duffy, Sean P", "…
## $ geo_facet <list> <>, <"New Mexico", "Santa Fe (NM)">, <>, "Santa Fe (NM…
## $ media <list> [<data.frame[1 x 6]>], [<data.frame[0 x 0]>], [<data.f…
## $ eta_id <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
print(head(articles_df))
## uri
## 1 nyt://article/2180670d-3746-549a-b8c1-aeeb232afbe1
## 2 nyt://article/f6a45e9b-1f77-5f75-b538-3e95c72a5db6
## 3 nyt://article/b831afe8-eda5-53c0-ba24-697237038399
## 4 nyt://article/9e53daea-f06f-537b-b5fc-e629f10eead2
## 5 nyt://article/821e56d6-cc94-56fa-a5ae-624a83a3970b
## 6 nyt://article/65e014a8-04e5-5e31-bf63-b90eb3e761ed
## url
## 1 https://www.nytimes.com/2025/03/07/us/politics/trump-musk-doge-power.html
## 2 https://www.nytimes.com/2025/02/27/us/gene-hackman-wife-dead-new-mexico.html
## 3 https://www.nytimes.com/2025/03/14/us/politics/trump-travel-ban.html
## 4 https://www.nytimes.com/2025/03/07/us/gene-hackman-investigation-cause-death.html
## 5 https://www.nytimes.com/2025/03/02/movies/oscars-winners-list.html
## 6 https://www.nytimes.com/2025/03/08/us/gene-hackman-betsy-arakawa.html
## id asset_id source published_date updated section
## 1 1e+14 1e+14 New York Times 2025-03-07 2025-03-17 22:31:28 U.S.
## 2 1e+14 1e+14 New York Times 2025-02-27 2025-02-28 02:36:21 U.S.
## 3 1e+14 1e+14 New York Times 2025-03-14 2025-03-18 03:31:59 U.S.
## 4 1e+14 1e+14 New York Times 2025-03-07 2025-03-08 00:15:12 U.S.
## 5 1e+14 1e+14 New York Times 2025-03-02 2025-03-03 22:29:44 Movies
## 6 1e+14 1e+14 New York Times 2025-03-08 2025-03-09 23:10:32 U.S.
## subsection nytdsection
## 1 Politics u.s.
## 2 u.s.
## 3 Politics u.s.
## 4 u.s.
## 5 movies
## 6 u.s.
## adx_keywords
## 1 United States Politics and Government;Government Employees;Layoffs and Job Reductions;Trump, Donald J;Rubio, Marco;Duffy, Sean P;Collins, Douglas A (1966- );Musk, Elon;State Department;Federal Aviation Administration;Veterans Affairs Department;Government Efficiency Department (US)
## 2 Actors and Actresses;Deaths (Fatalities);Hackman, Gene;Arakawa, Betsy (1959-2025);New Mexico;Santa Fe (NM)
## 3 United States International Relations;Executive Orders and Memorandums;Terrorism;Immigration and Emigration;Visas;Diplomatic Service, Embassies and Consulates;Travel Warnings;Trump, Donald J;State Department
## 4 Deaths (Fatalities);Hackman, Gene;Arakawa, Betsy (1959-2025);Santa Fe (NM)
## 5 Academy Awards (Oscars);Movies
## 6 Deaths (Fatalities);Content Type: Personal Profile;Arakawa, Betsy (1959-2025);Hackman, Gene;Santa Fe (NM)
## column byline type
## 1 NA By Jonathan Swan and Maggie Haberman Article
## 2 NA By Julia Jacobs and Ali Watkins Article
## 3 NA By Charlie Savage, Ken Bensinger and Allison McCann Article
## 4 NA By Nicholas Bogel-Burroughs and Julia Jacobs Article
## 5 NA By Shivani Gonzalez Article
## 6 NA By Nicholas Bogel-Burroughs, Julia Jacobs and Richard Fausset Article
## title
## 1 Inside the Explosive Meeting Where Trump Officials Clashed With Elon Musk
## 2 Scattered Pills Found Near Body of Hackman’s Wife as Inquiry Continues
## 3 Draft List for New Travel Ban Proposes Trump Target 43 Countries
## 4 Gene Hackman Died a Week After His Wife, Both From Natural Causes
## 5 Oscars 2025 Winners: Full List
## 6 A Haunting Coda: The 7 Days Gene Hackman’s Wife Could No Longer Care for Him
## abstract
## 1 Simmering anger at the billionaire’s unchecked power spilled out in a remarkable Cabinet Room meeting. The president quickly moved to rein in Mr. Musk.
## 2 The sheriff’s office in Santa Fe County, N.M., is investigating after the actor Gene Hackman, his wife and one of their dogs were found dead inside their home.
## 3 A draft circulating inside the administration lists three tiers of countries whose citizens may face restrictions on entering the United States.
## 4 The actor’s wife, Betsy Arakawa, died of a respiratory illness linked to rodents, New Mexico officials said. Mr. Hackman had Alzheimer’s, which contributed to his death from heart disease.
## 5 The complete list of winners at the 97th annual Academy Awards.
## 6 The exact details may never be known, but Mr. Hackman, 95 with advanced Alzheimer’s, was alone for about a week after his wife and sole caregiver died.
## des_facet
## 1 United States Politics and Government, Government Employees, Layoffs and Job Reductions
## 2 Actors and Actresses, Deaths (Fatalities)
## 3 United States International Relations, Executive Orders and Memorandums, Terrorism, Immigration and Emigration, Visas, Diplomatic Service, Embassies and Consulates, Travel Warnings
## 4 Deaths (Fatalities)
## 5 Academy Awards (Oscars), Movies
## 6 Deaths (Fatalities), Content Type: Personal Profile
## org_facet
## 1 State Department, Federal Aviation Administration, Veterans Affairs Department, Government Efficiency Department (US)
## 2
## 3 State Department
## 4
## 5
## 6
## per_facet
## 1 Trump, Donald J, Rubio, Marco, Duffy, Sean P, Collins, Douglas A (1966- ), Musk, Elon
## 2 Hackman, Gene, Arakawa, Betsy (1959-2025)
## 3 Trump, Donald J
## 4 Hackman, Gene, Arakawa, Betsy (1959-2025)
## 5
## 6 Arakawa, Betsy (1959-2025), Hackman, Gene
## geo_facet
## 1
## 2 New Mexico, Santa Fe (NM)
## 3
## 4 Santa Fe (NM)
## 5
## 6 Santa Fe (NM)
## media
## 1 image, photo, Cabinet officials generally like the concept of what Elon Musk set out to do — reducing waste, fraud and abuse in government — but have been frustrated by the hacksaw approach to upending the government and the lack of consistent coordination., Pete Marovich for The New York Times, 1, https://static01.nyt.com/images/2025/03/07/multimedia/07dc-trump-musk-zqgm/07dc-trump-musk-zqgm-thumbStandard.jpg, https://static01.nyt.com/images/2025/03/07/multimedia/07dc-trump-musk-zqgm/07dc-trump-musk-zqgm-mediumThreeByTwo210-v2.jpg, https://static01.nyt.com/images/2025/03/07/multimedia/07dc-trump-musk-zqgm/07dc-trump-musk-zqgm-mediumThreeByTwo440-v2.jpg, Standard Thumbnail, mediumThreeByTwo210, mediumThreeByTwo440, 75, 140, 293, 75, 210, 440
## 2 NULL
## 3 image, photo, The most stringent restriction level would flatly bar citizens from 11 countries from entering the United States., Ian Willms for The New York Times, 1, https://static01.nyt.com/images/2025/03/14/multimedia/14dc-travel-ban-topart-whmt/14dc-travel-ban-topart-whmt-thumbStandard.jpg, https://static01.nyt.com/images/2025/03/14/multimedia/14dc-travel-ban-topart-whmt/14dc-travel-ban-topart-whmt-mediumThreeByTwo210.jpg, https://static01.nyt.com/images/2025/03/14/multimedia/14dc-travel-ban-topart-whmt/14dc-travel-ban-topart-whmt-mediumThreeByTwo440.jpg, Standard Thumbnail, mediumThreeByTwo210, mediumThreeByTwo440, 75, 140, 293, 75, 210, 440
## 4 image, photo, Gene Hackman and his wife, Betsy Arakawa, at the Academy Awards in Los Angeles in 1989. They were found dead at their New Mexico home in late February., Ralph Dominguez/MediaPunch/IPX, via AP, 0, https://static01.nyt.com/images/2025/03/07/multimedia/07nat-hackman-investigation-fmtq/07nat-hackman-investigation-fmtq-thumbStandard.jpg, https://static01.nyt.com/images/2025/03/07/multimedia/07nat-hackman-investigation-fmtq/07nat-hackman-investigation-fmtq-mediumThreeByTwo210.jpg, https://static01.nyt.com/images/2025/03/07/multimedia/07nat-hackman-investigation-fmtq/07nat-hackman-investigation-fmtq-mediumThreeByTwo440.jpg, Standard Thumbnail, mediumThreeByTwo210, mediumThreeByTwo440, 75, 140, 293, 75, 210, 440
## 5 image, photo, Adrien Brody, left, won best actor and Mikey Madison, right, won best actress at the 97th Academy Awards., Philip Cheung for The New York Times, 1, https://static01.nyt.com/images/2025/03/02/arts/02oscars-winners-list-combo/02oscars-winners-list-combo-thumbStandard-v2.jpg, https://static01.nyt.com/images/2025/03/02/arts/02oscars-winners-list-combo/02oscars-winners-list-combo-mediumThreeByTwo210-v3.jpg, https://static01.nyt.com/images/2025/03/02/arts/02oscars-winners-list-combo/02oscars-winners-list-combo-mediumThreeByTwo440-v3.jpg, Standard Thumbnail, mediumThreeByTwo210, mediumThreeByTwo440, 75, 140, 293, 75, 210, 440
## 6 image, photo, Betsy Arakawa and Gene Hackman at the Academy Awards in 1989. They married in 1991 and settled in Santa Fe, N.M., Ralph Dominguez/MediaPunch/IPX, via AP, 0, https://static01.nyt.com/images/2025/03/08/multimedia/08nat-hackman-death-03-fbwh/08nat-hackman-death-03-fbwh-thumbStandard.jpg, https://static01.nyt.com/images/2025/03/08/multimedia/08nat-hackman-death-03-fbwh/08nat-hackman-death-03-fbwh-mediumThreeByTwo210.jpg, https://static01.nyt.com/images/2025/03/08/multimedia/08nat-hackman-death-03-fbwh/08nat-hackman-death-03-fbwh-mediumThreeByTwo440.jpg, Standard Thumbnail, mediumThreeByTwo210, mediumThreeByTwo440, 75, 140, 293, 75, 210, 440
## eta_id
## 1 0
## 2 0
## 3 0
## 4 0
## 5 0
## 6 0
This code loops through the columns of the dataframe and convert list columns to character strings.
articles_df_clean <- data.frame(lapply(articles_df, function(col) {
if (is.list(col)) {
# Convert each list element to a single string (separated by "; ")
sapply(col, function(x) paste(x, collapse = "; "))
} else {
col
}
}), stringsAsFactors = FALSE)
articles_df_clean <- articles_df %>%
mutate(across(where(is.list), ~ sapply(.x, toString)))
sections <- table(articles_df_clean$section)
sorted_section <- sort(sections, decreasing = TRUE)
sections_df <- as.data.frame(sorted_section)
colnames(sections_df) <- c("section", "count")
ggplot(sections_df, aes(x = reorder(section, -count), y = count)) +
geom_bar(stat = "identity", fill = "steelblue") +
labs(title = "Most viewed popular sections by count",
x = "Section", y = "Article Count") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
From this plot we can say that the readers most viewed section in last 30 days is US news section.
publish_day <- table(articles_df_clean$published_date)
sorted_publish_date <- sort(publish_day, decreasing = TRUE)
date_df <- as.data.frame(sorted_publish_date)
colnames(date_df) <- c("published_date", "count")
ggplot(date_df, aes(x = reorder(published_date, -count), y = count)) +
geom_bar(stat = "identity", fill = "steelblue") +
labs(title = "Number of Popular Articles by Date",
x = "Published Date", y = "Article Count") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
From this chart we can see that most popular articles views day in last 30 days is March 7th, 2025