title: R call a group of columns by list of index
body: <p>I am struggling assign values to a matrix. I have the index stored in a list 
   <code>loc_x</code>, which is a list of integers. And I am trying to assign numbers to matrix <code>Nas</code>, on the columns indexed by <code>loc_x</code>. say <code>loc_x = [1 2 3 5]</code>, How do I assign 1 to <code>Nas[1,]</code> on columns <code>[1,2,3,5]</code>?</p>
  
  <p>I tried <code>Nas[1,c(loc_x)] = 1</code> or converted <code>loc_x</code> to a matrix or array but fails..And I tried to put commas in <code>loc_x</code> but also fails.. I know this could be done by a for loop but my dataset is large, so I want to know if there is a efficient way to do this X. Thanks for any help!</p>