title: Loop for Shapiro-Wilk normality test for multiple variables in R
body: <p>I have a dataset called "My_data", and three variables called a, b, c. 
  The head of my data is like this:</p>
  
  <pre><code>&gt; head(My_data)
    variable_A variable_B     value
  1  Jul       W1 18.780294
  2  Jul       W2 13.932397
  3  Aug       W2 20.877093
  4  Sep       W3  9.291295
  5  May       W1 10.939570
  6  Oct       W1 12.23671
  </code></pre>
  
  <p>I want to do Shapiro normality test for each subset with two variables.</p>
  
  <pre><code>&gt; Subset1=subset(My_data, variable_A== "Jan" &amp; variable == "W1")
  &gt; Subset2=subset(My_data, variable_A== "Feb" &amp; variable == "W1")
  &gt; Subset3=subset(My_data, variable_A== "Mar" &amp; variable == "W1")
  .
  .
  &gt; Subset_n=subset(My_data, variable_A== "Jan" &amp; variable == "W2")
  &gt; 
  </code></pre>
  
  <p>Subset_n2=subset(My_data, variable_A== "Jan" &amp; variable == "W3")</p>
  
  <p>You see that I need to make a lot of subsets and do Shapiro for each one. </p>
  
  <p>But if I can loop it, it makes my job easier. </p>
  
  <p>I have this code for lopping</p>
  
  <pre><code>&gt; loop_Shapiro = list()
  &gt; for (ids in unique(My_data$variable_A)){
  +   My_sub = subset(x=My_data, subset=variable_A==ids)
  +   
  +   loop_Shapiro[[ids]] = shapiro.test(My_sub$value)
  + }
  </code></pre>
  
  <p>This loop works, but the problem is that it is only based subletting with one variable, but I want for two.</p>