This question is based on this post.
Say that I have an NA:
df <- data.frame(start = c(10, 20), end = c(15,NA), label = c('ex1','ex2'))
When I use the following code:
df[, seq(.SD[['start']], .SD[['end']]), by = label]
I get the following error:
Error in `[.data.frame`(df, , seq(.SD[["start"]], .SD[["end"]]), by = label) :
unused argument (by = label)
How do I get something like this?:
label V1
1: ex1 10
2: ex1 11
3: ex1 12
4: ex1 13
5: ex1 14
6: ex1 15
7: ex2 20