title: How do you using the mapply function to create random draws from a dataset?
body: <p>I currently have a random bunch numbers listed from -1billion to positive 1 billion in a dataset, that is all. I want to write a function so that it will pull 5 random numbers 100,000 times from the dataset and then see how many times the number is below 0. Can I use the mapply function for this? or would another function be better.</p>
  <p>The dataset is called numbers as has 2 columns, with the column i want to pull the numbers from called listofnumbers.</p>
  <p>Currently i have a for loop but it seems to take forever to run, the code is below</p>
  <pre><code>    ```
      n=5
      m=100000
  
      base_table &lt;- as_tibble (0)
  
      for (j in 1:m)
      {
      for (i in 1:n)
      {
      base_table[i,j] &lt;- as_tibble(sample_n(numbers, 1) %&gt;% pull(listofnumbers))
      }
      } 
      ```
  </code></pre>
  <p>Can anyone help?</p>