r - How do I count total items in a column based off of both ID and date without using a for loop? -


i have column of dates [6-13 6-13 7-13 ...], ids, [1 27 34 555 ...] , column of 1's , 2's represent event on day. trying count, each date given , each id given, total number of 1 , twos (or total number of days match day , id). in language might write similar below psuedo-code:

for id in ids     date in dates        *count number of days  id == id , date == date* 

how can without loop?

we can dplyr

library(dplyr) df1 %>%    count(date, id, anothercol) 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -