開始使用免費開始

用 relocate() 調整欄位位置

當你想保留資料中的所有欄位、只改變部分欄位的順序時,relocate() 很實用。select() 也能做到,但更適合在只需要部分欄位時使用。來試試看 relocate() 吧!

本練習屬於課程

使用 dplyr 進行程式設計

檢視課程

動手互動練習

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

# Move consumer_price_index after usd_conversion_rate
relocated_cpi <- imf_data %>% 
  ___(___, 
      ___)

# Glimpse at this data, focusing on the column order
___
編輯並執行程式碼