I have a large datatable. Is there a function to count the occurence of a certain value?
data.table: .N dplyr: count()
.N
count()
filter the datatable for your desired value and return the count in one step :
DT[col == value, .N ]
You might need to wrap the value in quotes.
You can add a grouping if necessary:
DT[col == value, .N , by = group_col]
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.