title: How to plot specific data points in a column in R script
body: <p>Imagine there are two columns, one for p-value and the other representing slope. I want to find a way to plot only the slope data points that have a significant p-value. Here is my code:</p>
  
  <pre><code>print("State the file name (include .csv)")
  filename &lt;- readline()
  file &lt;- read.csv(filename)
  
  print ("Only include trials with p-value &lt; .05? (enter yes or no)")
  pval_filter &lt;- readline()
  if (pval_filter == "yes"){
     i &lt;- 0
     count &lt;- 0
     filtered &lt;- NULL
     while (i &gt; length(file$pval)){
        if (file$pval[i] &lt; .05){
           filtered[count] &lt;- i
           count &lt;- count + 1
        }
        i &lt;- i + 1
     }
  
     x &lt;- 0
     while (x != -1){
        print("State the variable to be plotted")
        temp_var &lt;- readline()
        counter &lt;- 0
        var &lt;- NULL
        while (counter &gt; length(filtered)){
           var[counter] = file [, temp_var][filtered[counter]]
           counter &lt;- counter + 1
           }
  
        print ("State the title of the histogram")
        title &lt;- readline()
        hist(var, main = title, xlab = var)
        print("Enter -1 to exit or any other number to plot another variable")
        x &lt;- readline()
      }
  }
  </code></pre>