title: Error in seq.default(1, 1, length.out = nrow(x)) : argument 'length.out' must be of length 1
body: <p>I am trying to make a simple function that finds outliers and marks the corresponding observation as valid.obs=1 if it is not an outlier,or valid.obs=0 if it is indeed an outlier.
  For example, for the variable "income", the outliers will be identified based on the following formula: if </p>
  
  <blockquote>
    <p>income>=(99percentile(income)+standard_deviation(income)), then it is an outlier.
    If income&lt;(99percentile(income)+standard_deviation(income)), then it is not an outlier.</p>
  </blockquote>
  
  <pre><code>rem= function(x){
    u=quantile(x,probs=0.99,na.rm=TRUE) #calculating the 99th percentile
    s=sapply(x,sd,na.rm=TRUE) #calculating the standard deviation
    uc=u+s
    v=seq(1,1,length.out = nrow(x))
    v[x&gt;=uc]=0
    v[x&lt;uc]=1
    x$valid.obs=v
    return(x) 
  }
  </code></pre>
  
  <p>I go on to apply this function to a single column of a dataframe. The dataframe has 132 variables with 5000 entries. I choose the variable "income"</p>
  
  <pre><code>apply(data["income"],2,rem)
  </code></pre>
  
  <p>It, then shows the error: </p>
  
  <pre><code> Error in seq.default(1, 1, length.out = nrow(x)) : 
   argument 'length.out' must be of length 1 
  </code></pre>
  
  <p>Outside the function "rem", the following code works just fine:</p>
  
  <pre><code>nrow(data["income"])
  [1] 5000
  </code></pre>
  
  <p>I am new to R and there aren't many functions in my armoury yet.The objective of this function is very simple. Please let me know why this error has crept in and if there is an easier way to go about this?</p>