Tutorial by Examples

When data is "tidy," it is often organized into several tables. To combine the data for analysis, we need to "update" one table with values from another. For example, we might have sales data for performances, where attributes of the performer (their budget) and of the location ...
# example data a = data.table(id = c(1L, 1L, 2L, 3L, NA_integer_), x = 11:15) # id x # 1: 1 11 # 2: 1 12 # 3: 2 13 # 4: 3 14 # 5: NA 15 b = data.table(id = 1:2, y = -(1:2)) # id y # 1: 1 -1 # 2: 2 -2 Intuition Think of x[i] as selecting a subset of x for each row of i....

Page 1 of 1