title: Logical "Except" operator for If statements in R
body: <p>FYI, I'm new to using R so my code is likely quite clunky. I've done my homework on this but haven't been able to find an "Except" logical operator for R and really need something like that in my code. My input data is a .csv containing integers and null values with 12 columns and 1440 rows.</p>
  
  <pre><code>oneDayData &lt;- read.csv("data.csv") # Loading data
  oneDayMatrix &lt;- data.matrix(oneDayData, rownames.force = NA) #turning data frame into     a matrix
  
  
  rowBefore &lt;- data.frame(oneDayData[i-1,10], stringsAsFactors=FALSE) # Creating a variable to be used in the if statement, represents cell before the cell in the loop
  
  ctr &lt;- 0 # creating a counter and zeroing it
  
  
  for (i in 1:nrow(oneDayMatrix)) {
    if ((oneDayMatrix[i,10] == -180) &amp; (oneDayMatrix[i,4] == 0)) { # Makes sure that there is missing data matched with a zero in activityIn
      impute1 &lt;- replace(oneDayMatrix[ ,10], oneDayMatrix[i,10], rowBefore)
      ctr &lt;- (ctr + 1) # Populating the counter with how many rows get changed
    }
    else{
      print("No data fit this criteria.")
    }
  }
  print(paste(ctr, "rows have been changed.")) # Printing the counter and number of rows that got changed enter code here
  </code></pre>
  
  <p>I would like to add some kind of EXCEPT condition to my if statement or equivalent that says something like: employ the two previous conditions (see if statement in code) EXCEPT when oneDayMatrix[i-1, 4] > 0. I would really appreciate any help with this and thank you in advance!</p>