開始使用免費開始

取代與移除

在上一個練習中,你看到 sfo_surveyphone 欄位含有多餘的括號與連字號。客服團隊要求所有電話號碼都要採用 "123 456 7890" 這種格式。這個練習中,你會運用新的 stringr 技巧來滿足這個需求。

已載入 dplyrstringr,並可使用 sfo_survey

本練習屬於課程

R 的資料清理

檢視課程

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Remove parentheses from phone column
phone_no_parens <- sfo_survey$phone %>%
  # Remove "("s
  ___(fixed(___)) %>%
  # Remove ")"s
  ___
編輯並執行程式碼