Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Q1 (40 pts). a. (5 pts) Read Houston Police data from the file houstonPolice.txt and store in a data frame named hP. b. (5 pts)
Q1 (40 pts). a. (5 pts) Read Houston Police data from the file "houstonPolice.txt" and store in a data frame named hP. b. (5 pts) Find the number of crimes where street name is MAIN and zip code is 77002. The output should be 612. c. (5 pts) Add new column to the data frame with name "FullAddress" and concatenate StreetNo, StreetName, StreetType, City, and ZIPCode using paste function. Print the full address of the first line. The output should be "5500 ANTOINE DR HOUSTON 77091". d. (5 pts) Save the crime data of April 1 to an excel file named "April1.xlsx". Do not include row names. (Do not submit the xlsx file. xIsx file should be created when I run your R script.) e. (5 pts) Delete the "NIBRSClass" column and delete the rows where StreetNo is NA. f. (5 pts) Update the data frame by setting the hour of crime at 1 MAIN, 77002 as 10. Also, find the crime at 1 MAIN having no ZIPCode and set its ZIPCode as 77002. Print the crimes at 1 MAIN, 77002 after your modifications. Therefore, your code should print 2 records. g. (5 pts) Find the number of crimes on March 3 and the number of different full addresses for those crimes on March 3. The output should be 724 and 610. h. (5 pts) Find the maximum and minimum longitude and latitude values in the dataset
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started