-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
Would be implementable a special by aggregating on full data and by groups? I mean.
> library(data.table)
data.table 1.17.0 using 6 threads (see ?getDTthreads). Latest news: r-datatable.com
> input <- if (file.exists("flights14.csv")) {
+ "flights14.csv"
+ } else {
+ "https://raw.githubusercontent.com/Rdatatable/data.table/master/vignettes/flights14.csv"
+ }
> flights <- fread(input)
trying URL 'https://raw.githubusercontent.com/Rdatatable/data.table/master/vignettes/flights14.csv'
Content type 'text/plain; charset=utf-8' length 9587529 bytes (9.1 MB)
downloaded 9.1 MB
> ans <- flights[, .(.N), by = .(origin)]
> ans
origin N
<char> <int>
1: JFK 81483
2: LGA 84433
3: EWR 87400
> rbind(cbind(flights[, .(.N)], origin = NA), ans)[,c(2,1)]
origin N
<char> <int>
1: <NA> 253316
2: JFK 81483
3: LGA 84433
4: EWR 87400being the last, the output of, let's say, flights[, .(.N), sby = origin]
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels