Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Complete the function,get_us_states(df), below, where its input,df, is a data frame structured like the combined COVID-19 data frame (df_covid19), having the columnsProvince/State,Country/Region,Confirmed,Timestamp; and it returns

Complete the function,get_us_states(df), below, where

  • its input,df, is a data frame structured like the combined COVID-19 data frame (df_covid19), having the columns"Province/State","Country/Region","Confirmed","Timestamp";
  • and it returns a tibble containing only those rows ofdfthat are from the United States where the"Province/State"field is exactly the name of any one of the US states.

Regarding the second requirement, the returned object should include a row where the"Province/State"field is"Georgia", but it shouldnotinclude a row where this field is, say,"Atlanta, GA". (Put differently, we will assume the state-level accounts already include city-level counts.)

The tibble returned by your function should only have these three columns:

  1. "Confirmed": The number of confirmed cases, taken from the inputdf.
  2. "Timestamp": The timestamp taken from the inputdf.
  3. "ST": The two-letterabbreviationfor the state's name.

Pay attention to item (3): your returned tibble should not have the state's full name, but rather, its two-letter postal code abbreviation (e.g.,"GA"instead of"Georgia"). To help you out, here is a code cell that defines a data frame calledSTATE_NAMESthat holds both a list of state names and their two-letter abbreviations.

Note: The test cell for this exercise reuses functions defined in the test cell for Exercise 0. So even if you skipped Exercise 0, please run its test cell before running the one below.

image text in transcribed
\f

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions

Question

3 Do you know any other company that applies a similar mission?

Answered: 1 week ago

Question

1.explain evaporation ?

Answered: 1 week ago

Question

Who was the first woman prime minister of india?

Answered: 1 week ago

Question

Explain the concept of going concern value in detail.

Answered: 1 week ago

Question

Define marketing.

Answered: 1 week ago