title: How to run multiple semi-partial correlations in R?
body: <p>I am a beginner in R. What I want to do is compute semi partial correlations in R, while controlling for one variable.</p>
  <p>For example, in the case of the mtcars data set, I would like to compute all the correlations between cyl, disp, hp, drat, wt, qsec, vs, am, gear, carb, while controlling for mpg.</p>
  <p>From what I observed, most packages, including ppcor, do something like this:</p>
  <pre><code>pcor.test(a, b, c)
  </code></pre>
  <p>Which means computing the correlation between a and b while controlling for c.
  But I do not know of a way to extend that to multiple variables while controlling for one. I am not sure how to extend this syntax to achieve that. In pseudocode, what I would want is something like:</p>
  <pre><code>compute_correlations(cyl, disp, hp, drat, wt, qsec, vs, am, gear, carb; control for = mpg)
  </code></pre>
  <p>And then visualize the result in a heatmap, with labeling that says how I computed all these correlations while controlling for 'mpg'. Is there any way to do this efficiently in R? I guess what I could do is make all these correlations myself for each pair of variables, but that would take a long time and it would be inefficient.</p>
  <p>This is quite easily achievable in SPSS but I do not know how to do this in R.</p>