How to find number of unique ids corresponding to each date in a data drame

前端 未结 3 799
一整个雨季
一整个雨季 2021-01-24 07:28

I have a data frame that looks like this:

      date         time              id            datetime    
1 2015-01-02 14:27:22.130 999000000007628 2015-01-02 14         


        
3条回答
  •  梦谈多话
    2021-01-24 08:26

    Or we could use n_distinct from library(dplyr)

    library(dplyr) 
    df %>%
       group_by(date) %>%
       summarise(id=n_distinct(id))
    

提交回复
热议问题