用分组值替换列中的NA

时间:2018-08-13 10:47:40

标签: r dplyr na

篮球赛季的固定装置以表格形式显示在网页上。在读入R之前,我已复制并另存为.csv文件。清理很简单,直到找不到用 Round 数字替换NA的方法为止。见下文:

    ROUND DATE       TIME   VENUE                           
   <int> <date>     <time> <chr>                               
 1     1 2018-03-16 20:40  Casey Stadium Crt 2                    
 2    NA 2018-03-16 20:40  Frankston Crt 2                        
 3    NA 2018-03-16 20:40  State Basketball Centre Court 4        
 4    NA 2018-03-16 20:40  Waverley Crt 2                         
 5    NA 2018-03-16 21:40  Sandringham Crt 4                      
 6     2 2018-03-23 19:40  Sandringham Crt 2                      
 7    NA 2018-03-23 20:40  Chelsea Crt 2                          
 8    NA 2018-03-23 20:40  Knox Crt 3                             
 9    NA 2018-03-23 20:40  Waverley Crt 2                         
10    NA 2018-03-23 21:30  Balwyn High Crt 1                      
11     3 2018-04-20 20:30  Balwyn High Crt 2                      
12    NA 2018-04-20 20:30  Brighton Crt 1                         
13    NA 2018-04-20 20:40  Chelsea Crt 
14    NA 2018-04-20 20:40  Kilsyth Crt 5                          
15    NA 2018-04-20 20:40  Knox Crt 4                             

第1-5行应全部为ROUND = 1,第6-10行应全部为ROUND = 2等等。我想我必须在“ DATE”之前进行“ group_by”,但是那又如何呢?谢谢您的帮助

0 个答案:

没有答案