As title, I want the output of "corresponding question" column same as the raw dataset, but it replaces all spaces in that column with "."
The code I use are:
raw= read.csv("DATA2X02 class survey 2020 (Responses) - Form responses 1.csv", na=c("n/a", "", " "))
x = raw %>% janitor::clean_names()
colnames(x)[2] = "covid_test"
colnames(x)[4] = "postcode"
colnames(x)[5] = "dentist"
colnames(x)[6] = "university_work"
colnames(x)[7] = "social_media"
colnames(x)[8] = "dog_or_cat"
colnames(x)[9] = "live_with_parents"
colnames(x)[10] = "exercising"
colnames(x)[12] = "asthma"
colnames(x)[13] = "paid_work"
colnames(x)[14] = "fav_season"
colnames(x)[16] = "height"
colnames(x)[17] = "floss_frequency"
colnames(x)[18] = "glasses"
colnames(x)[20] = "steak_preference"
colnames(x)[21] = "stress_level"
tibble(Position = 1:21, `Variable name` = colnames(x), `Corresponding question` = colnames(raw)) %>%
gt::gt() %>%
gt::tab_source_note("Table 1: Variable names and the corresponding questions asked in the DATA2002 survey.")
My output is: my output
I want the output like: output should like
Thanks!