Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
fxj
on Aug 17, 2016
|
parent
|
context
|
favorite
| on:
15 Page Tutorial for R
> a[1-3] [1] 1 3 > a[[1-3]] Error in a[[1 - 3]] : attempt to select more than one element
The first line evaluates to a[-2]. I think what the author meant was a[1:3]. a[[-2]] gives an error, a[[2]] is valid R.
capnrefsmmat
on Aug 17, 2016
[–]
a[-2] is valid R syntax. A negative index means that element is omitted from the result, so a[-2] is a without the second element.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: