開始使用免費開始

找出遺漏的觀測值

你是在核電廠工作的稽核員,需要驗證在整整 1 年期間,每座反應爐是否每天都完成安全檢查。安全檢查紀錄存於 reactor_df,這是一個包含 datereactorcheck 欄位的資料框。

已為你建立兩個向量 datesreactors,分別包含全年所有日期與電廠內的所有反應爐。 你將使用 expand_grid() 搭配 anti_join() 的組合,找出特定反應爐在某些日期沒有被檢查的情況。

dplyr 套件已為你預先載入。

本練習屬於課程

使用 tidyr 重塑資料

檢視課程

練習說明

  • 使用 expand_grid() 建立一個包含 datereactor 這兩個變數所有組合的 tibble。請使用已為你建立的 datesreactors 向量。
  • datereactor 兩個欄位,對 full_dfreactor_df 進行 anti-join。

動手互動練習

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

# Create a tibble with all combinations of dates and reactors
full_df <- ___

# Find the reactor - date combinations not present in reactor_df
full_df %>% 
  ___
編輯並執行程式碼