Question: Shorten my code, combine the two filter statements from number 1 to create a list of states in the same region as TX

Shorten my code, combine the two filter statements from number 1 to create a list of states in the same region as "TX" without having the region number explicitly used in the statement.
HINT: Get the first statement to return just the region (use $region).> tx_data <- states_1_%>% filter(abbreviation =="TX")
> tx_region <- tx_data$region
> same_region_as_TX <- states_1_%>% filter(region %in% tx_region)
> print(same_region_as_TX)
# A tibble: 5\times 6
name abbreviation region area_sq_miles water_area_sq_miles population_2015
1 Arkansas AR 65317911432978204
2 Louisiana LA 65237891744670724
3 New Mexico NM 61215902922085109
4 Oklahoma OK 66989913043911338
5 Texas TX 6268596736527469114

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!