title: Learning data.table - how to update values by row number and column name
body: <p>My last few posts have been written poorly, so I will attempt to do a better and cleaner job this time. </p>
  
  <p>I am learning how to work with the data tables object, and one task I am struggling with is updating values in the data table by both row number and column name at the same time. With data.frames this is much easier and I just do the following:</p>
  
  <pre><code>my_df = as.data.frame(matrix(ncol = 10, nrow = (100)))
  names(my_df) = c("P1", "P2", "P3", "P4", "P5", "Q1", "Q2", "Q3", "Q4", "Q5")
  head(my_df)
  
    P1 P2 P3 P4 P5 Q1 Q2 Q3 Q4 Q5
  1 NA NA NA NA NA NA NA NA NA NA
  2 NA NA NA NA NA NA NA NA NA NA
  3 NA NA NA NA NA NA NA NA NA NA
  4 NA NA NA NA NA NA NA NA NA NA
  5 NA NA NA NA NA NA NA NA NA NA
  6 NA NA NA NA NA NA NA NA NA NA
  
  replacement = c(1, 2, 3, 4, 5)
  my_df[2, names(my_df)[1:5]] = replacement
  head(my_df)
  
    P1 P2 P3 P4 P5 Q1 Q2 Q3 Q4 Q5
  1 NA NA NA NA NA NA NA NA NA NA
  2  1  2  3  4  5 NA NA NA NA NA
  3 NA NA NA NA NA NA NA NA NA NA
  4 NA NA NA NA NA NA NA NA NA NA
  5 NA NA NA NA NA NA NA NA NA NA
  6 NA NA NA NA NA NA NA NA NA NA
  </code></pre>
  
  <p>so, fairly easy with a dataframe. however, I am struggling with this same exact task with a datatable. using the same structure for an example data table as i did with the dataframe above, i've tried the following:</p>
  
  <pre><code>my_dt = data.table(matrix(ncol = 10, nrow = (100)))
  names(my_dt) = c("P1", "P2", "P3", "P4", "P5", "Q1", "Q2", "Q3", "Q4", "Q5")
  head(my_dt)
  
     P1 P2 P3 P4 P5 Q1 Q2 Q3 Q4 Q5
  1: NA NA NA NA NA NA NA NA NA NA
  2: NA NA NA NA NA NA NA NA NA NA
  3: NA NA NA NA NA NA NA NA NA NA
  4: NA NA NA NA NA NA NA NA NA NA
  5: NA NA NA NA NA NA NA NA NA NA
  6: NA NA NA NA NA NA NA NA NA NA
  
  replacement = c(1, 2, 3, 4, 5)
  # my_dt[i == 2, names(my_dt)[1:5]] = replacement
  # my_dt[i == 2, names(my_dt)[1:5] := replacement]  
  # my_dt[2, names(my_dt)[1:5]] = replacement
  # my_dt[2, names(my_dt)[1:5] := replacement]  
  </code></pre>
  
  <p>however none of the four commented lines did the correct substitution. appreciate any help!</p>
  
  <p>Thanks, 
  Canovice</p>