Hello and Louthan we are going to learn how to create frequented tables with the package.
Plier the function count of the data.
I'm going to use the example is deam all that contains information about a sample of car owners and
I'm going to build a frequency table for the verbal education level which is a categorical variable
with five categories.
So I will build a table that will contain the following.
The Aptos frequency or the cons or the cumulative count is the relative frequencies and the cumulated
relative frequency or the cumulative percentages.
First of all I have to load the package plier and then build the initial table.
I will call it my table which will contain the app told frequences the count on line and for that I
will use the function count and the Pontin I have to specify that the date operator name ID more and
the variable of interest in our educational level and do it apples grows in code like this.
Let's run this and let's pretend our product table.
So you can see here for each category of the terrible educational level we have the frequency is the
counts in this column Stracke.
So for example they are one hundred and thirty in the members subjects in the first category college
degree.
Now let's compute the percentages or the AF or the relative frequencies or in how to do that.
We will simply take the values in the column track frequencies and the table my table that the column
frequencies and we divide each value by the number of rows of the data frame D-MA.
In other words we will divide it by the number of cases in the variable in the data frame the story
so let's create the new vector with the percentages.
And now let's see this factor part.
Here we have the relay to frequences the percentages for each category of the variable education level
Nachlass compute the cumulative counts you get that come from banks and you probably know it from the
previous lecture the come from function in the arm.
So we simply apply this function consomme to the same column to track the count of the variable.
My table that Thuram then let's bring the cumulate to columns here they are.
You can see them here in the console finally let compute the cumulative percentages.
Therefore we are going to apply a trick here maybe you now read from the previous lecture that we simply
do by the cumulative counts all the values in that factor that cumulated comes by that number of rows
of the variable of the data crane Thore DMO computed with a function and know without that and that
the accumulative percentages here they are in the vector.
And now all we have to do is add the cumulative counts and the percentages and accumulate a percentage
of course to the initial table.
How using the foreign currency bind.
So to the initial table my table we add that cumulated columns the percentages and the cumulative percentages
and the new table will be called.
Of course my table lads do it.
And now let's pretend our final table.
That's it.
So here for each category the variable education you have to count the cumulative counts the percentages
and the cumulative percentages.
That's it.
Thank you.