Top "Data.table" questions

The R data.

Assign multiple columns using := in data.table, by group

What is the best way to assign to multiple columns using data.table? For example: f <- function(x) {…

r dataframe data.table variable-assignment colon-equals
How does one change the levels of a factor column in a data.table

What is the correct way to change the levels of a factor column in a data.table (note: not data …

r data.table
Remove rows conditionally from a data.table in R

I have a data.table with fields {id, menuitem, amount}. This is transaction data - so, ids are unique, but …

r data.table
Fastest way to replace NAs in a large data.table

I have a large data.table, with many missing values scattered throughout its ~200k rows and 200 columns. I would like …

r performance dataframe data.table
Use a value from the previous row in an R data.table calculation

I want to create a new column in a data.table calculated from the current value of one column and …

r data.table
Filtering out duplicated/non-unique rows in data.table

Edit 2019: This question was asked prior to changes in data.table in November 2016, see the accepted answer below for both …

r duplicates data.table
How to create a lag variable within each group?

I have a data.table: set.seed(1) data <- data.table(time = c(1:3, 1:4), groups = c(rep(c("b", "a"), …

r data.table plyr dplyr
Extract row corresponding to minimum value of a variable by group

I wish to (1) group data by one variable (State), (2) within each group find the row of minimum value of another …

r dplyr data.table aggregate
Group by multiple columns and sum other multiple columns

I have a data frame with about 200 columns, out of them I want to group the table by first 10 or …

r grouping aggregate plyr data.table
How to reorder data.table columns (without copying)

I'd like to reorder columns in my data.table x, given a character vector of column names, neworder: library(data.…

r data.table