เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

Rearranging with select() and last_col()

You can also use last_col() with : to organize the last few columns in your data. Work with the select() function to match the ordering of the imf_data shown. Note that this ordering is different than what you saw in the previous exercise.

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

Programming with dplyr

ดูคอร์ส

คำแนะนำการฝึกหัด

  • Choose columns iso through year.
  • Then, match for columns starting with "gov" using regular expressions.
  • Finally, have your remaining columns ordered as gdp_in_billions_of_usd to the last column.

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

imf_data %>% 
  select(
    # Choose columns iso to year
    ___,
    # Choose columns starting with "gov" using regular expression
    ___,
    # Keep remaining columns too
    ___) %>% 
  names()
แก้ไขและรันโค้ด