title: shift columns up or down by n rows in dataframe
body: <p>Let's suppose I have the following data.frame <code>df</code>:</p>
  
  <pre><code>set.seed(1)
  df = data.frame(a = rnorm(10), 
                  b = rnorm(10), 
                  c = rnorm(10), 
                  d = rnorm(10))
  
  &gt; df
              a           b           c           d
  1  -0.6264538  1.51178117  0.91897737  1.35867955
  2   0.1836433  0.38984324  0.78213630 -0.10278773
  3  -0.8356286 -0.62124058  0.07456498  0.38767161
  4   1.5952808 -2.21469989 -1.98935170 -0.05380504
  5   0.3295078  1.12493092  0.61982575 -1.37705956
  6  -0.8204684 -0.04493361 -0.05612874 -0.41499456
  7   0.4874291 -0.01619026 -0.15579551 -0.39428995
  8   0.7383247  0.94383621 -1.47075238 -0.05931340
  9   0.5757814  0.82122120 -0.47815006  1.10002537
  10 -0.3053884  0.59390132  0.41794156  0.76317575
  </code></pre>
  
  <p>I desire to shift up (only) columns <code>b</code>, <code>c</code> and <code>d</code> by let's say 3 rows. Column <code>a</code> has to remain fixed and the rows with <code>NAs</code> removed.</p>
  
  <p>Here my desired output for a shift of 3 rows:</p>
  
  <pre><code>&gt; df_shift_3
              a           b           c           d
  1  -0.6264538 -2.21469989 -1.98935170 -0.05380504 
  2   0.1836433  1.12493092  0.61982575 -1.37705956
  3  -0.8356286 -0.04493361 -0.05612874 -0.41499456
  4   1.5952808 -0.01619026 -0.15579551 -0.39428995
  5   0.3295078  0.94383621 -1.47075238 -0.05931340
  6  -0.8204684  0.82122120 -0.47815006  1.10002537
  7   0.4874291  0.59390132  0.41794156  0.76317575 
  </code></pre>
  
  <p>How can I create a function that generalise this output for a <code>up</code> or <code>down</code> shift of <code>n</code> rows?</p>
  
  <p>I tried to use the following function <a href="http://function" rel="nofollow noreferrer">https://rdrr.io/cran/useful/man/shift.column.html</a> but no success.</p>
  
  <p>Thanks for any help</p>