1

In Matlab, if I want to get a slice of a dataset starting from 100th row to the very last row, I can do something like t2 = t1(100:end,:). I am just wondering if there is an equivalent way to do it in R, except using dim() function to get the number of rows first? I just want to avoid this extra step. Thanks!

user3768495
  • 4,077
  • 7
  • 32
  • 58
  • 1
    `t1[100:nrow(t1), ]` – alistaire Jan 26 '16 at 01:43
  • in short, no there is no such shortcut in base R. some packages have an equivalent, though, e.g. `.N` from `data.table`. PS its been so long since ive seen matlabs inexplicable use of parentheses (vs square brackets basically everywhere else in the world) to subset matrices... my eyes – MichaelChirico Jan 26 '16 at 01:49

0 Answers0