Excel File I/O The attached Distances xisx file contains a spreadsheet with the pairwise distances in mies of the top 100 US cities by population. A preview of the spreadsheet is shown below. The first row and first column contain the city names using the following format: city name comma space capitalized state abbreviation, e.g. Nashville, TN. Note that the very first cell of the spresheet, A1, is blank. Write a function called get_distance that accepts two character vectot inputs representing the names of two cities. The function returns the distance between them as an autput argument called distance. For example, the call get_distance("Seattle, WA", Miami, FL') should return 3723. If one or both of the specified cities are not in the file, the function retums-1. Your function should load the data only once. File VO is a time consuming aperation. Loading the data muitiple times is will likely cause a time-out error when submitting your function. Preview of the first five cities of Distonces.xiax Abilene, TX Akron, OH Albuquerque, NM Alexandria, VA Allentown, PA 2 Abilene, TX 3 Akron, OH 4 Albupuerque, NM Alexandria, VA 6 Allentown, PA 1481 724 1615 1710 1481 2185 382 552 724 2185 2331 2447 1615 382 2331 195 1730 552 2447 195

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
help
O kgeme: ot Co
htioseeningodmataorkconlaundh
Readng r
Excel File I/O
The attached Distances xlsx file contains a spreadsheet with the pairwise distances in mies of the top 100 US cities by population. A preview of the
spreadsheet is shown below. The first row and first column contain the city names using the following format: city name comma space capitalized
state abbreviation, e.g, Nashville, TN. Note that the very first cell of the spresheet, A1, is blank.
Write a function called get_distance that accepts two character vector inputs representing the names of two cities. The functian returns the distance
between them as an output argument called distance. For example, the cali get_distance('Seattle, WA', Miami, FL') should return 3723. If one ar
both of the specified cities are not in the file, the function returns 1.
Your function should load the data only once. File VO is a time consuming operation. Loading the date multiple times is will likely cause a time-out
error when submitting your function.
Preview of the first five cities of Distances.xisx
A
Abilene, TX
Akron, OH
Albuquerque, NM Alexandria, VA
Allentown, PA
2 Abilene, TX
3 Akron, OH
4 Albuquerque, NM
5 Nlexandria, VA
6 Allentown, PA
1481
724
1615
1730
1481
2185
382
5S2
724
2185
2331
2447
1615
382
2331
195
1730
552
2447
195
P Type tee to search
18-07-3021
Transcribed Image Text:O kgeme: ot Co htioseeningodmataorkconlaundh Readng r Excel File I/O The attached Distances xlsx file contains a spreadsheet with the pairwise distances in mies of the top 100 US cities by population. A preview of the spreadsheet is shown below. The first row and first column contain the city names using the following format: city name comma space capitalized state abbreviation, e.g, Nashville, TN. Note that the very first cell of the spresheet, A1, is blank. Write a function called get_distance that accepts two character vector inputs representing the names of two cities. The functian returns the distance between them as an output argument called distance. For example, the cali get_distance('Seattle, WA', Miami, FL') should return 3723. If one ar both of the specified cities are not in the file, the function returns 1. Your function should load the data only once. File VO is a time consuming operation. Loading the date multiple times is will likely cause a time-out error when submitting your function. Preview of the first five cities of Distances.xisx A Abilene, TX Akron, OH Albuquerque, NM Alexandria, VA Allentown, PA 2 Abilene, TX 3 Akron, OH 4 Albuquerque, NM 5 Nlexandria, VA 6 Allentown, PA 1481 724 1615 1730 1481 2185 382 5S2 724 2185 2331 2447 1615 382 2331 195 1730 552 2447 195 P Type tee to search 18-07-3021
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY