# Hurricanes in Michigan State & Reporting

1)

Note: Please use the library UScensus2000tract for this assignment

1. For missouri.tract dataframe, print the first 30 rows of data.
2. Find the datatype of all the columns and comment about the N/A values in each column.
3. Find the unique values for at least 5 columns of the above dataset

2)

For the below questions, please use nasaweather library

1. Report all the hurricanes in Michigan state occurred in the month of October.
2. Provide the names of storms occurred between the years of 1995-97 which occurred after 6 PM and pressure above the first quartile.

Note: Please manipulate data step by step and upload both screenshots and code snippets (.r files)

If you could not find a perfect answer for any of the question, that is totally fine. This is usually a part of the real project. Make sure your provide every trial you make to accomplish the task. If it fails, also show your explanation.

Solution

1)

install.packages(“UScensus2000tract”)

library(UScensus2000tract)

data(missouri.tract)

typeof(missouri.tract)

slotNames(missouri.tract)

head(missouri.tract@data, 30)   ## Question – 1

sapply(missouri.tract@data, typeof)   ## Question – 2

sapply(missouri.tract@data[,1:5], unique)  ## Question – 3

2)

install.packages(“nasaweather”)

library(nasaweather)

data(“storms”)

names(storms)

#### Question – 1

hurricanes = storms[which(storms\$type == “Hurricane”),]  ## Subsetting for hurricanes

hurricanesInOctober = hurricanes[which(hurricanes\$month == “10”),]  ## Subsetting for October

hurricanesInOctoberMichigan = hurricanesInOctober[which(hurricanesInOctober\$lat > 42 & hurricanesInOctober\$lat < 46 & hurricanesInOctober\$long > -86, hurricanesInOctober\$long < -83),]  ##  Subsetting for Michigan with approximate latitude longitudes

hurricanesInOctoberMichigan

#### Question – 2

stormsInGivenYears = storms[which(storms\$year >= 1995 & storms\$year <= 1997),] ## Subsetting for 1995-97

stormsInGivenYearsAfter6 = stormsInGivenYears[which(stormsInGivenYears\$hour >= 18),] ## Subsetting after 6 PM

stormsInGivenYearsAfter6PressureAboveFirstQuartile = stormsInGivenYearsAfter6[which(stormsInGivenYearsAfter6\$pressure >= as.integer(quantile(storms\$pressure)[2])),]  ## Subsetting for Pressure

stormsInGivenYearsAfter6PressureAboveFirstQuartile