I had multiple data sets that I merged into 1 dplyr dataframe with rbind.
GapAnalysis16 <- select(memSat16,
importance_communication_website_content,
satisfaction_communication_website_content,
status,
Year2016) %>%
rename(ComImpt=importance_communication_website_content,
ComSat = satisfaction_communication_website_content,
status = status,
year = Year2016)
GapAnalysis17July <- select(memSatJuly17,
importance_communication_website_content_JULY17,
satisfaction_communication_website_content_JULY17,
role_primary_new_JULY17,Year2017_July) %>%
rename(ComImpt=importance_communication_website_content_JULY17,
ComSat = satisfaction_communication_website_content_JULY17,
status = role_primary_new_JULY17,
year = Year2017_July)
GapAnalysis <- rbind(GapAnalysis17July,GapAnalysis16)
And got my new combined data set:
ComImpt ComSat status year
1 4 2 1 1
2 NA NA 1 1
3 4 5 5 1
4 3 3 5 1
5 6 6 5 1
6 5 5 1 1
I needed it in long form so converted it:
GapAnalysis_LongForm <- GapAnalysis %>%
gather(key = Product,value = Score, ComSat, ComImpt)
And now have this:
status year Product Score
<dbl> <dbl> <chr> <dbl>
1 1. 1. ComSat 2.
2 5. 1. ComSat 5.
3 5. 2. ComSat 3.
4 1. 1. ComSat 5.
5 1. 1. ComImpt 4.
6 5. 1. ComSat 4.
I now need to recode ComSat and ComImpt to values ( 1 & 2) but am stumped. Recode and recode_factor are giving me errors. I'm trying to get output something like this:
status year Product Score
<dbl> <dbl> <chr> <dbl>
1 1. 1. 1 2.
2 5. 1. 1 5.
3 5. 2. 1 3.
4 1. 1. 1 5.
5 1. 1. 2 4.
6 5. 1. 1 4.
Any general points in the right direction?
I appreciate it!!!