title: How to replace certain values in a specific rows and columns with NA in R?
body: <p>In my data frame, I want to replace certain blank cells and cells with values with NA. But the cells I want to replace with NAs has nothing to do with the value that cell stores, but with the combination of row and column it is stored in.</p>
  
  <p>Here's a sample data frame DF:</p>
  
  <pre><code>  Fruits   Price   Weight   Number of pieces
  
    Apples      20      2          10
    Oranges     15      4          16
    Pineapple   40      8           6
    Avocado     60      5          20
  </code></pre>
  
  <p>I want to replace Pineapple'e weight to NA and Orange's number of pieces to NA. </p>
  
  <pre><code>DF$Weight[3] &lt;- NA
  DF$`Number of pieces`[2] &lt;- NA  
  </code></pre>
  
  <p>This replaces any value that's stored in that position and that may change. I want to use specific row and column names to do this replacement so the position of value becomes irrelevant. </p>
  
  <p>Output:</p>
  
  <pre><code> Fruits   Price   Weight   Number of pieces
  
    Apples      20      2          10
    Oranges     15      4          NA
    Pineapple   40      NA           6
    Avocado     60      5          20
  </code></pre>
  
  <p>But if order of the table is changed, this would replace wrong values with NA. </p>
  
  <p>How should I do this?</p>