依多個群組拆分
gdp_by_industry_oceania 包含農業與觀光業在 1995 與 2010 年所產生的 GDP。你的目標是建立寬格式的 data.table,其中包含每個年度與產業的 GDP 欄位。
本練習屬於課程
R 的 data.table 資料合併
練習說明
- 印出
gdp_by_industry_oceania。 - 將
gdp_by_industry_oceania轉換為寬格式,每個國家為一列,並拆分"gdp"欄位,讓結果包含每個產業與每個年份的 gdp 欄位。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Split gdp by industry and year
___