library(rjson)
library(RJSONIO)
##
## Attaching package: 'RJSONIO'
## The following objects are masked from 'package:rjson':
##
## fromJSON, toJSON
library(gt)
library(ggplot2)
The data was uploaded from the NY Times API I created. It shows data for the top stories in the U.S.
usa_data <- fromJSON("https://api.nytimes.com/svc/topstories/v2/us.json?api-key=VhHaGQL7qb0A4ulIICuMg2M5JKNWijv5")
usa_results <- usa_data[['results']]
new1 <- toJSON(usa_results, pretty = TRUE)
test <- fromJSON(new1)
finalData <- c()
for (num in 1:25)
{
sample <- test[[num]]
finalData <- rbind(finalData, sample)
}
finalData <- as.data.frame(finalData)
gt(finalData[,3:11]) |>
tab_header(title = "Top Stories")
| Top Stories | ||||||||
| title | abstract | url | uri | byline | item_type | updated_date | created_date | published_date |
|---|---|---|---|---|---|---|---|---|
| Police Were Told Maine Gunman Had Threatened to Carry Out Shooting Spree | A Maine sheriff’s office tried to contact the gunman who later carried out America’s deadliest mass shooting this year, but the office ultimately left him alone. | https://www.nytimes.com/2023/10/30/us/police-maine-shooting-gunman.html | nyt://article/ace68b8b-51b3-5e3f-bd07-a24bb53e502d | By Nicholas Bogel-Burroughs and Chelsia Rose Marcius | Article | 2023-10-30T19:25:48-04:00 | 2023-10-30T19:25:48-04:00 | 2023-10-30T19:25:48-04:00 |
| Top Marine General Hospitalized After Apparently Having Heart Attack | The episode happened as the service’s No. 2 position has been left unfilled because of a senator’s blockade on promotions of senior military officers. | https://www.nytimes.com/2023/10/30/us/politics/marine-commandant-hospitalized.html | nyt://article/6739f50b-d02e-5a3f-99cb-bf03fba9c743 | By John Ismay and Eric Schmitt | Article | 2023-10-30T19:52:23-04:00 | 2023-10-30T19:07:10-04:00 | 2023-10-30T19:07:10-04:00 |
| Union Victories May Lift Biden, as U.A.W. Targets Tesla and Others | President Biden’s support for autoworkers helped them make big wage gains, and labor organizers are looking to bring about similar gains elsewhere as carmakers transition to electric vehicles. | https://www.nytimes.com/2023/10/30/us/politics/biden-uaw.html | nyt://article/5a958d87-7831-5da4-9252-722aa16b6f16 | By Jonathan Weisman | Article | 2023-10-30T19:03:01-04:00 | 2023-10-30T19:03:01-04:00 | 2023-10-30T19:03:01-04:00 |
| Judge Orders Border Agents to Stop Cutting Texas’ Barbed Wire Fence | The wrangling over concertina wire along the Rio Grande is the latest legal battle between Texas and the Biden administration over border security. | https://www.nytimes.com/2023/10/30/us/texas-border-concertina-wire-judge-paxton.html | nyt://article/5bbcd830-2b7d-5dc1-93ca-ce567c90c503 | By J. David Goodman | Article | 2023-10-30T18:18:23-04:00 | 2023-10-30T18:18:23-04:00 | 2023-10-30T18:18:23-04:00 |
| Democratic Rifts Over Israel Burst to the Forefront in Congress | The divisions are erupting as the House weighs a G.O.P. bid to censure the only Palestinian-American member of Congress for criticizing Israel and votes on a large aid bill to back Israel in the war in Gaza. | https://www.nytimes.com/2023/10/30/us/politics/democrats-israel-gaza.html | nyt://article/da34df76-32ae-5b8c-b44f-55be28a95476 | By Karoun Demirjian | Article | 2023-10-30T17:32:06-04:00 | 2023-10-30T17:30:21-04:00 | 2023-10-30T17:30:21-04:00 |
| Biden’s Support for Israel Now Comes With Words of Caution | The administration has become more critical of Israel’s response to the Hamas attacks, a shift that U.S. officials attribute to the humanitarian crisis in Gaza. | https://www.nytimes.com/2023/10/30/us/politics/biden-israel.html | nyt://article/c007d5f4-976d-5722-837a-aedd136720d9 | By Michael D. Shear, David E. Sanger and Edward Wong | Article | 2023-10-30T20:07:03-04:00 | 2023-10-30T16:45:26-04:00 | 2023-10-30T16:45:26-04:00 |
| Biden Issues Executive Order to Create A.I. Safeguards | The sweeping order is a first step as the Biden administration seeks to put guardrails on a global technology that offers great promise but also carries significant dangers. | https://www.nytimes.com/2023/10/30/us/politics/biden-ai-regulation.html | nyt://article/6d4b57d1-2aba-5a35-b339-311da613a2a3 | By Cecilia Kang and David E. Sanger | Article | 2023-10-30T19:13:12-04:00 | 2023-10-30T16:37:15-04:00 | 2023-10-30T16:37:15-04:00 |
| $23,500 in Coins to Pay a Settlement? Judge Says Keep the Change and Try Again. | A Colorado judge ordered a welding company to use a check or other conventional method to pay a settlement after it tried to deliver 6,500 pounds in coins. | https://www.nytimes.com/2023/10/30/us/coins-lawsuit-payment-colorado.html | nyt://article/769dc8c0-8136-5a14-8317-8559f19e454d | By Amanda Holpuch | Article | 2023-10-30T16:57:47-04:00 | 2023-10-30T14:36:05-04:00 | 2023-10-30T14:36:05-04:00 |
| Cars Seized by Police Get Supreme Court Scrutiny in Civil Forfeiture Case | Several justices seemed wary of allowing law enforcement officials to take vehicles used to commit crimes when their owners were not at fault. | https://www.nytimes.com/2023/10/30/us/politics/supreme-court-civil-forfeiture.html | nyt://article/fe311410-4e4b-5ae2-95bc-dc208c6d6875 | By Adam Liptak | Article | 2023-10-30T14:58:42-04:00 | 2023-10-30T14:15:37-04:00 | 2023-10-30T14:15:37-04:00 |
| Tracking Tropical Storm Pilar | See the likely path and wind arrival times for Pilar. | https://www.nytimes.com/interactive/2023/us/pilar-map-path-tracker.html | nyt://interactive/d47e12f0-1191-582d-be56-9b21ce7ed9ca | By William B. Davis, Madison Dong, Judson Jones, John Keefe and Bea Malsky | Interactive | 2023-10-30T19:52:17-04:00 | 2023-10-30T09:45:20-04:00 | 2023-10-30T09:45:20-04:00 |
| A Vibrant Center in Oakland Has Nurtured Disabled Artists for Nearly 50 Years | Artists from Creative Growth who are developmentally disabled have shown their works at the San Francisco Museum of Modern Art, the Pompidou Center in Paris and beyond. | https://www.nytimes.com/2023/10/30/us/a-vibrant-center-in-oakland-has-nurtured-disabled-artists-for-nearly-50-years.html | nyt://article/34c669c9-84a9-5bcc-b455-695a838bd4b7 | By Soumya Karlamangla | Article | 2023-10-30T14:28:03-04:00 | 2023-10-30T08:59:32-04:00 | 2023-10-30T08:59:32-04:00 |
| Colorado Trial Considers Whether the 14th Amendment Disqualifies Trump | Some constitutional experts argue that a clause in the amendment should bar Donald J. Trump from becoming president again, but that view is far from universal among legal scholars. | https://www.nytimes.com/2023/10/30/us/politics/trump-colorado-trial-14th-amendment-jan-6.html | nyt://article/2cf57e9d-b91b-51dc-88bb-3eec6ada4e74 | By Maggie Astor | Article | 2023-10-30T17:47:32-04:00 | 2023-10-30T08:28:26-04:00 | 2023-10-30T08:28:26-04:00 |
| Trump Is Still Far Ahead in Iowa Poll, With Haley Matching DeSantis for 2nd | Former President Donald J. Trump leads his closest competitors by 27 percentage points in a new Des Moines Register poll, but Nikki Haley has surged to tie Ron DeSantis. | https://www.nytimes.com/2023/10/30/us/politics/trump-iowa-poll-republican-presidential-primary.html | nyt://article/d8443edb-d29a-5577-920a-a853c98b4f11 | By Maggie Astor | Article | 2023-10-30T07:54:08-04:00 | 2023-10-30T07:50:41-04:00 | 2023-10-30T07:50:41-04:00 |
| How Trump’s Verbal Slips Could Weaken His Attacks on Biden’s Age | Donald Trump, 77, has relentlessly attacked President Biden, 80, as too old for office. But the former president himself has had a series of gaffes that go beyond his usual freewheeling style. | https://www.nytimes.com/2023/10/30/us/politics/trump-biden-age.html | nyt://article/57aec20d-e82f-50b9-bbc9-b646822151a0 | By Michael C. Bender and Michael Gold | Article | 2023-10-30T10:33:13-04:00 | 2023-10-30T05:02:10-04:00 | 2023-10-30T05:02:10-04:00 |
| The Latest Target for California Conservatives? Local School Boards | Several California school districts have required parental notification when students seek to change their gender identity. Opponents say the policies have needlessly divided communities. | https://www.nytimes.com/2023/10/30/us/california-school-transgender-policy.html | nyt://article/2bbd068a-baf5-57b7-80f9-18f555d86f8a | By Jill Cowan | Article | 2023-10-30T12:42:22-04:00 | 2023-10-30T05:00:48-04:00 | 2023-10-30T05:00:48-04:00 |
| Biden to Issue First Regulations on Artificial Intelligence Systems | In an order to be issued on Monday, the White House will outline requirements that the most advanced A.I. products be tested to assure they cannot be used to produce weapons, among other regulations. | https://www.nytimes.com/2023/10/30/us/politics/biden-artificial-intelligence.html | nyt://article/0d409c61-88a7-50b8-8a04-37e3498fcb04 | By David E. Sanger and Cecilia Kang | Article | 2023-10-30T18:47:48-04:00 | 2023-10-30T03:00:29-04:00 | 2023-10-30T03:00:29-04:00 |
| Federal Judge Reinstates Gag Order on Trump in Election Case | Judge Tanya Chutkan ruled that her order should stay in effect while the former president’s lawyers pursue an appeal. | https://www.nytimes.com/2023/10/29/us/politics/trump-gag-order-chutkan.html | nyt://article/3db926a7-75f0-5c5f-b95b-3e639718b03a | By Alan Feuer | Article | 2023-10-30T10:28:04-04:00 | 2023-10-29T20:45:37-04:00 | 2023-10-29T20:45:37-04:00 |
| Eyedrops From Major Brands May Cause Infection, F.D.A. Says | Target, CVS and Rite Aid are pulling products from shelves after federal investigators found unsanitary conditions and recommended a recall. | https://www.nytimes.com/2023/10/29/us/eyedrops-fda-warning.html | nyt://article/85c747a2-c3cb-578b-9a0a-8d68a744368d | By Rebecca Carballo | Article | 2023-10-30T15:50:03-04:00 | 2023-10-29T19:47:49-04:00 | 2023-10-29T19:47:49-04:00 |
| ‘A Communal Sigh of Relief’: Emerging From Lockdown, Lewiston Gathers to Mourn | Residents in and around the city, no longer under lockdowns, spent the weekend coming together to mourn, share meals and prepare to bury their dead. | https://www.nytimes.com/2023/10/29/us/maine-mourning-mass-shooting.html | nyt://article/99c43652-d2b6-5175-bf2b-a3c11c79e417 | By Amelia Nierenberg | Article | 2023-10-30T13:17:05-04:00 | 2023-10-29T19:11:39-04:00 | 2023-10-29T19:11:39-04:00 |
| Maine Gunman Disclosed He Had Mental Health Issues, Gun Shop Owner Says | The man sought to purchase a gun suppressor in August, but was denied the item after he reported mental health issues on a federal form, the gun store owner said. | https://www.nytimes.com/2023/10/29/us/maine-shooting-gunman.html | nyt://article/73ef163a-7f5b-5e31-8f6d-fbcd0aaa9cdc | By Chelsia Rose Marcius | Article | 2023-10-30T18:15:42-04:00 | 2023-10-29T15:22:51-04:00 | 2023-10-29T15:22:51-04:00 |
| The Devil’s Bargain Mike Pence Could Not Escape | The former vice president tied himself to Donald Trump in the 2016 campaign and it may have cost him a political future. | https://www.nytimes.com/2023/10/29/us/politics/pence-trump-2024.html | nyt://article/98ef3ac6-3d09-5ca3-89a8-3bf8be1cea41 | By Adam Nagourney | Article | 2023-10-29T23:48:57-04:00 | 2023-10-29T05:02:14-04:00 | 2023-10-29T05:02:14-04:00 |
| Primary Battles Brew Over Progressive Democrats’ Stances on Israel | Representative Summer Lee of Pennsylvania, who joined calls for a cease-fire, has become one of several progressive lawmakers facing new pressure from primary challengers. | https://www.nytimes.com/2023/10/29/us/politics/democrats-israel-palestine-primaries.html | nyt://article/484b79b6-8235-5ab5-8b97-2732757d5107 | By Jonathan Weisman | Article | 2023-10-30T10:36:42-04:00 | 2023-10-29T05:02:11-04:00 | 2023-10-29T05:02:11-04:00 |
| Why Illegal Border Crossings Are at Sustained Highs | Shifting U.S. policies, global migration patterns and changing migrant demographics all contribute to record levels of border crossings. | https://www.nytimes.com/interactive/2023/10/29/us/illegal-border-crossings-data.html | nyt://interactive/fa01fac5-eb41-56e1-a261-4cb8754085fd | By Ashley Wu | Interactive | 2023-10-29T22:42:26-04:00 | 2023-10-29T05:01:43-04:00 | 2023-10-29T05:01:43-04:00 |
| Halloween Headaches in Salem, Mass.: Traffic. Crowds. Tiny Liquor Bottles? | Miniature bottles of alcohol known as “nips” litter gardens, parks and playgrounds, prompting the Witch City to propose a ban. | https://www.nytimes.com/2023/10/29/us/halloween-headaches-in-salem-mass-traffic-crowds-tiny-liquor-bottles.html | nyt://article/da9f26dc-c60a-56ad-a154-990f60e02f25 | By Jenna Russell and Kieran Kesner | Article | 2023-10-29T23:47:22-04:00 | 2023-10-29T05:01:20-04:00 | 2023-10-29T05:01:20-04:00 |
| Obama’s Presidential Center Is Rising, Finally, in Chicago | The city beat out others to host Barack Obama’s presidential center. But as construction continues on the South Side, some residents fear being priced out. | https://www.nytimes.com/2023/10/29/us/obama-center-chicago-south-side.html | nyt://article/38c71455-17fe-5a9f-9f72-937b8d9d5230 | By Mitch Smith | Article | 2023-10-29T05:00:19-04:00 | 2023-10-29T05:00:19-04:00 | 2023-10-29T05:00:19-04:00 |
I am interested in how long the titles are for each story. The results are below. It appears that most of the titles were relatively long, which is surprising to me because most titles are usually short in my experience.
For reference, the following section contains 50 characters:
This is a sentence. This is another sentence. Bye.
For more reference, the following section contains 100 characters:
These are sentences for an article that I think is a bit too long. It just keeps on going and going.
finalData$characters <- nchar(finalData[,3])
ggplot(finalData, aes(characters)) +
geom_bar() +
labs(title = "Bar Graph of the Number of Characters") +
xlab("Number of Characters") +
ylab("Frequency")