Calculate normality of each group in a dataset using R
<p>I have a dataset of about 7 lacs of entries. Suppose it has 5 columns : </p>

<pre><code>Cust_Id(around 340 unique Ids), Expense_Type, Expense($), Income_Type and Income($).
</code></pre>

<p>I want to examine the relative stability of Income and Expense within any <code>Cust_Id</code> group as determined by statistical analysis.</p>

<p>I found out the statistical information (mean, median, standard deviation) of the data using the <code>summaryBy</code> function of R. </p>

<p>Now I want to find the normality for each group of <code>Cust_Id</code>. I used <code>shapiro.test()</code> function but it results in a normality score of the whole data and not of the grouped values. Am I in the right path for solving the requirement? I am a newbie in this field. Please suggest ways to solve this.</p>

<p>Sample Data:</p>

<pre><code>Cust_Id  Income_Type  Income  Expense_Type  Expense
10001    ABC          4356.89  XYZ          569.45
10003    DEF          5678.34  PQR          4532.43
10006    FRG          5783.43  JHK          9724.56
10001    DEG          5345.34  HTY          7856.34
10008    HGT          678.67   KIL          7893.13
10003    GRT          678.67   JHK          6544.11
</code></pre>