Rstudio, need help with #3 for the Tourism_Type column. Says i
can use an If-Then logic.
Create the Cleaned_Tourism Table Part 1 1. If necessary, set your working directory. Read the tourism table and create the cleaned_tourism table. 2. Remove the columns_1995 through _2013. 3. Create the Country_Name and Tourism_Type columns from values in the Country column. Valid values for Tourism_Type are Inbound tourism and Outbound tourism. Remove rows that contain this labeling information and no other data.
Filter A 1997 + COUNTRY COUNTRY Series Series 1995 1995 1996 1996 1998 1998 _1999 1999 2000 2000 2001 2001 2002 2002 2003 2003 _2004 2004 2005 2005 A 1997 1 4 AFGHANISTAN 2 NA Inbound tourism 3 NA Arrivals - Thousands NA Tourism expenditure in the country - US$ Mn $ 4 IMF 5 NA Travel - US$ Mn IMF 6 NA Passenger transport - US$ Mn IMF 7 NA Outbound tourism 8 NA Departures - Thousands 9 NA Tourism expenditure in other countries - US$ Mn IMF 10 NA Travel - US$ Mn IMF 11 NA Passenger transport - US$ Mn IMF 12 8 ALBANIA 13 NA Inbound tourism 14 NA Arrivals - Thousands VF 304 287 119 184 371 317 354 470 557 645 748 15 TF BE BE Be BE . 16 NA Arrivals - Thousands - NA Arrivals - Thousands NA Tourism expenditure in the country - US$ Mn THS 41 64 23 22 26 32 34 36 41 34 57 17 - IMF 70.4 93.8 33.6 60.23 218 398 451 492 537 756 880 10 AIA Tell TC Air Tess AN INC CE 77 דר CA 911 חסכ AAC לסוג Eาว Eכל OCA
#1. Read the tourism table and create the cleaned tourism table Tour <- read_rds ("C:/Users/gerar/Downloads/tourism.rds") continent <- read_rds ("C:/Users/gerar/Downloads/country_info.rds") head(Tour) #2. Remove the columns _1995 through _2013 df <- select (Tour, C(A, COUNTRY, Series, "_2014") df #3. create the country_name and Tourism_Type columns df <- df %>% mutate (COUNTRY_NAME = ifelse(!is.na(A), COUNTRY, NA)) %>% fill(COUNTRY_NAME) %>% filter(is.na(A))
Rstudio, need help with #3 for the Tourism_Type column. Says i can use an If-Then logic.
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Rstudio, need help with #3 for the Tourism_Type column. Says i can use an If-Then logic.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!