load libary and apikey in backend

look at the data and pull the useful info

nyturl <- paste("https://api.nytimes.com/svc/topstories/v2/science.json?api-key=", apikey, sep='')

scienceData <- fromJSON(nyturl) #Look at what is useful

scienceData <- scienceData %>% 
as.data.frame() %>%
select(-results.multimedia)

scienceData <- scienceData %>% 
select(results.title,results.section,results.item_type,results.published_date,results.short_url)

scienceData
##                                                                             results.title
## 1                                                Sign Up for the Science Times Newsletter
## 2                                                                                        
## 3                            Covid and Diabetes, Colliding in a Public Health Train Wreck
## 4                          Is Russia quitting the International Space Station? Not quite.
## 5                         Man Sentenced to 650 Years in Prison in Brutal 1980s Sex Crimes
## 6                                        Cuts in Britain Could Cause a Covid Data Drought
## 7                                                What to Know About the Bird Flu Outbreak
## 8                   A Tanker’s Giant U-Turn Reveals Strains in the Market for Russian Oil
## 9                            Fires, Then Floods: Risk of Deadly Climate Combination Rises
## 10                              Researchers Find Another Clue in the Dyatlov Pass Mystery
## 11                                 Cannabis for Better Sex? Here’s What the Science Says.
## 12                                  As Gas Prices Soar, Biden’s Climate Ambitions Sputter
## 13                          E.P.A. Decides Against Limiting Perchlorate in Drinking Water
## 14                  Adriana Hoffmann, Botanist Who Fought for Chile’s Forests, Dies at 82
## 15              Many Teens Report Emotional and Physical Abuse by Parents During Lockdown
## 16                                             您是否正在接受、支付或為他人提供長期照護?
## 17                                       ¿Recibes, pagas o brindas cuidado a largo plazo?
## 18                                             您是否正在接受、支付或为他人提供长期照护?
## 19                             Are You Receiving, Providing or Paying for Long-Term Care?
## 20                                          How Aphasia Steals the Ability to Communicate
## 21                     New A.L.S. Treatment Lacks Evidence of Benefit, F.D.A. Panel Finds
## 22                                   Omicron Blunted Vaccine Protection Among Adolescents
## 23            Ivermectin Does Not Reduce Risk of Covid Hospitalization, Large Study Finds
## 24                                    Flamingo No. 492 Is Still on the Run 17 Years Later
## 25      On the Space Station, U.S. and Russian Astronauts Steer Around the War in Ukraine
## 26       Americans are taking fewer precautions two years into the pandemic, a poll says.
## 27 A NASA astronaut will soon land on Earth in a Russian spacecraft. Here’s how to watch.
##    results.section   results.item_type    results.published_date
## 1          science EmbeddedInteractive 2016-02-05T18:18:53-05:00
## 2            admin EmbeddedInteractive 2015-04-16T14:13:18-04:00
## 3           health             Article 2022-04-03T16:43:53-04:00
## 4            world             Article 2022-04-02T11:25:06-04:00
## 5               us             Article 2022-04-02T10:05:36-04:00
## 6           health             Article 2022-04-02T09:28:35-04:00
## 7               us             Article 2022-04-02T09:05:57-04:00
## 8          climate             Article 2022-04-02T05:47:09-04:00
## 9          climate             Article 2022-04-01T14:00:11-04:00
## 10           world             Article 2022-04-01T11:21:53-04:00
## 11            well             Article 2022-04-01T10:53:08-04:00
## 12         climate             Article 2022-04-01T05:02:49-04:00
## 13         climate             Article 2022-03-31T22:36:12-04:00
## 14         climate             Article 2022-03-31T17:21:09-04:00
## 15          health             Article 2022-03-31T13:00:11-04:00
## 16         science             Article 2022-03-30T17:42:18-04:00
## 17         science             Article 2022-03-30T17:42:17-04:00
## 18         science             Article 2022-03-30T17:42:16-04:00
## 19         science             Article 2022-03-30T17:42:04-04:00
## 20            well             Article 2022-03-30T17:17:23-04:00
## 21          health             Article 2022-03-30T17:12:49-04:00
## 22          health             Article 2022-03-30T17:00:11-04:00
## 23          health             Article 2022-03-30T17:00:10-04:00
## 24              us             Article 2022-03-30T12:42:03-04:00
## 25         science             Article 2022-03-30T07:55:22-04:00
## 26              us             Article 2022-03-29T22:18:55-04:00
## 27         science             Article 2022-03-29T20:56:06-04:00
##          results.short_url
## 1                         
## 2                         
## 3  https://nyti.ms/3u6fjN3
## 4  https://nyti.ms/3NKQ22I
## 5  https://nyti.ms/3qVznzq
## 6  https://nyti.ms/3qVySFy
## 7  https://nyti.ms/3rjIxpZ
## 8  https://nyti.ms/38ovooT
## 9  https://nyti.ms/3IYkNNN
## 10 https://nyti.ms/3tWMxyi
## 11 https://nyti.ms/3iTA73F
## 12 https://nyti.ms/3uOIumI
## 13 https://nyti.ms/3NDbuXj
## 14 https://nyti.ms/3LtSIzI
## 15 https://nyti.ms/3DrU9M6
## 16 https://nyti.ms/3tOF6ZP
## 17 https://nyti.ms/3ITo7d2
## 18 https://nyti.ms/3Dtpn5B
## 19 https://nyti.ms/3Dof6rr
## 20 https://nyti.ms/3JWjujM
## 21 https://nyti.ms/3iNkACr
## 22 https://nyti.ms/3tSjwUf
## 23 https://nyti.ms/3ISnOiW
## 24 https://nyti.ms/3tRriOf
## 25 https://nyti.ms/3Dpvk3v
## 26 https://nyti.ms/3DnLxGm
## 27 https://nyti.ms/3JTlGsv

create plot

As we can see 25 of them is article,2 is embedded interactive. I want to keep it to show you not all article.

As I said, 2 of them is admin item, and science, health and climate are the top three topic.

But I found two of the item is the same.

A little bit off topic, please see the scienceData$results.title result,

您是否正在接受、支付或為他人提供長期照護?(traditional Chinese) and 您是否正在接受、支付或为他人提供长期照护?(simplified Chinese) are the same.

that is why you can see the typeface looks similar

the only different is the article publiced in simplified and traditional Chinese.

Which mean the data may not be 100% good if you do not know foreign language, it is hard for people to combine as one.

ggplot(scienceData, aes(x=results.item_type)) + geom_histogram(stat="count")
## Warning: Ignoring unknown parameters: binwidth, bins, pad

ggplot(scienceData, aes(x=results.section)) + geom_histogram(stat="count")
## Warning: Ignoring unknown parameters: binwidth, bins, pad

scienceData$results.title
##  [1] "Sign Up for the Science Times Newsletter"                                              
##  [2] ""                                                                                      
##  [3] "Covid and Diabetes, Colliding in a Public Health Train Wreck"                          
##  [4] "Is Russia quitting the International Space Station? Not quite."                        
##  [5] "Man Sentenced to 650 Years in Prison in Brutal 1980s Sex Crimes"                       
##  [6] "Cuts in Britain Could Cause a Covid Data Drought"                                      
##  [7] "What to Know About the Bird Flu Outbreak"                                              
##  [8] "A Tanker’s Giant U-Turn Reveals Strains in the Market for Russian Oil"                 
##  [9] "Fires, Then Floods: Risk of Deadly Climate Combination Rises"                          
## [10] "Researchers Find Another Clue in the Dyatlov Pass Mystery"                             
## [11] "Cannabis for Better Sex? Here’s What the Science Says."                                
## [12] "As Gas Prices Soar, Biden’s Climate Ambitions Sputter"                                 
## [13] "E.P.A. Decides Against Limiting Perchlorate in Drinking Water"                         
## [14] "Adriana Hoffmann, Botanist Who Fought for Chile’s Forests, Dies at 82"                 
## [15] "Many Teens Report Emotional and Physical Abuse by Parents During Lockdown"             
## [16] "您是否正在接受、支付或為他人提供長期照護?"                                            
## [17] "¿Recibes, pagas o brindas cuidado a largo plazo?"                                      
## [18] "您是否正在接受、支付或为他人提供长期照护?"                                            
## [19] "Are You Receiving, Providing or Paying for Long-Term Care?"                            
## [20] "How Aphasia Steals the Ability to Communicate"                                         
## [21] "New A.L.S. Treatment Lacks Evidence of Benefit, F.D.A. Panel Finds"                    
## [22] "Omicron Blunted Vaccine Protection Among Adolescents"                                  
## [23] "Ivermectin Does Not Reduce Risk of Covid Hospitalization, Large Study Finds"           
## [24] "Flamingo No. 492 Is Still on the Run 17 Years Later"                                   
## [25] "On the Space Station, U.S. and Russian Astronauts Steer Around the War in Ukraine"     
## [26] "Americans are taking fewer precautions two years into the pandemic, a poll says."      
## [27] "A NASA astronaut will soon land on Earth in a Russian spacecraft. Here’s how to watch."