I have a vector of data called empl
which I extracted from a NetLogo model using RNetLogo and whose entries look like
[[1403]]
[1] 99
[[1404]]
[1] 97
[[1405]]
[1] 95
[[1406]]
[1] 95
[[1407]]
[1] 95
[[1408]]
[1] 97
I would like to perform simple operation on the last numbers of the vector's entries (the 95,97,...).
Now if I write something like
empl[731] + empl[890]
I get
Error in empl[i] + empl[j] : non-numeric argument to binary operator
If I understand correctly, this is due the fact that empl[i]
does not pick the last number in the corresponding entry but rather the whole entry for instance
[[1408]]
[1] 97
But I haven't been able to figure out how to get the last number only. I tried
empl[1,i]
and
empl[i,1]
but got
Error in empl[1, i] : incorrect number of dimensions
Any help on how to select the last number only would be much appreciated. If someone can emply understand the structure of the vector empl
that would be even better.