alperyilmaz / dav-exercises

Exercise questions submitted by Data Analysis and Visualization with R course students at YTU
GNU General Public License v3.0
1 stars 2 forks source link

Terrorist Attacks in US 1405A044 #61

Open 1405A044 opened 6 years ago

1405A044 commented 6 years ago

Question

Hi! My name is Billy Orwell. I am a statiscian in US Department of Defence. As we know, terrorism is the saddest thing nowadays. We have studied the terrorist attacks in the world between years of 1970 and 2006. In which year occurred the most attacks in the United States and in which city occurred the most attacks in that year?

Answers: -In 1970, there was 458 terrorist attacks. Highest terrorist attacks were in US in 1970. -In 1970, there was 82 terrorist attacks in New York City. Highest terrorist attacks were in 1970 in New York City.

library(dplyr)
download.file("https://raw.githubusercontent.com/daattali/statsTerrorismProject/master/globalterrorismdb.csv","globalterrorismdb.csv")
global_terror <- read.csv("globalterrorismdb.csv") 

terrorinUS <- global_terror %>%
  group_by(iyear)%>%
  filter(country_txt=="United States")%>%
  count(iyear)%>%
  arrange(desc(n))

#In 1970, there was 458 terrorist attacks. Highest terrorist attacks were in US in 1970.#

Whichcity <- global_terror %>%
  group_by(city)%>%
  filter(country_txt=="United States" & iyear=="1970")%>%
  select(city)%>%
  count(city)%>%
  arrange(desc(n))

#In 1970, there was 82 terrorist attacks in New York City. Highest terrorist attacks were  in 1970 in New York City.#

Additional information

Originality

Please mark relevant information with x, (ex. [x])

Is this question

If you select Inspired or Paraphrased please provide the links in markdown format ( [link](http://example.com) ). Please provide all relevant links. You can refer to DataCamp course pages if you're inspired by them.

Difficulty Level

According to you, what is the level of difficulty of the question (note: this can be modified by instructor after submission)