Apologies if this is the wrong title, I couldn't think what else to call it.
In matlab I was able to do the following:
x = (2,7,8)
var1 = (1:1:10,1)
var2 = var1(x,1)
Therefore it would create a new array. containing the values 2,7 and 8.
I am trying to replicate this process in R but I am struggling profusely and can't think how to word the question properly.
Any help would be much appreciated.
EDIT:
I am trying to create a new array, var2 by doing the following:
x = (2,7,8)
var1 = (1,2,3,4,5,6,7,8,9,10)
In matlab I could type the following:
var2 = var1(x,1)
Thus:
var2 = (2,7,8)
I am looking how to do this in R, using a defined variable to find the corresponding row numbers basically..