How to make and calculate the frequency distribution table in R?

5

I'm trying to make the Frequency distribution table in R, however, I'm not getting due to some formulas and calculations that I can not implement in R.

The structure of the frequency distribution table is as follows:

-------------------------------------
|Dados | Xi | Fi | Fr | Fac | Xi.Fi |
|      |    |    |    |     |       |
|      |    |    |    |     |       |
-------------------------------------

I do not know how to calculate the values of Xi , Fi , Fr , Fac , Xi.Fi and I do not quite understand what they represent in this table.

There are also other calculations that must be done that is Width , Quantity of Elements and Size of the range . In which I had the same difficulties to do too.

Data

The ROL I am using to make the frequency distribution table is this corresponding to the age of the students:

The ROL values I use in R are:

18 19 19 19 19 19 19 19 19 19 19 19 20 20 22 23 24 26 26 30 32

Question

How can I make the frequency distribution table of this data above in R?

    
asked by anonymous 27.06.2017 / 03:16

1 answer

9

For the first part of the question, the code below may help you.

library(dplyr)
dados <- c(18,19,19,19,19,19,19,19,19,19,19,19,20,20,22,23,24,26,26,30,32)
tabela <- data.frame(t(table(dados)))[,-1]
tabela$dados <- as.numeric(levels(tabela$dados))
tabela <- tabela %>% 
  mutate(Fr = 100*Freq/sum(Freq),
         Fac = cumsum(Freq),
         Xi.Fi = dados*Freq)
tabela

As for your doubts, Xi and Dados of the table structure you put, it's the same thing, it's all the values your variable can take. Fi represents the frequency that each value of the variable occurs. Fr is the relative frequency, Faq is the cumulative frequency and Xi.Fi is the multiplication of each value of the variable by its respective frequency.

I suggest you take some Basic Statistics material or book. You'll find this part that explains the creation of the frequency table.

As for the second part of the other calculations, the same book (or material) must have a part for creating this table with intervals. There you will see the step by step for the creation of the same, there you will be able to respond to Amplitude, Quantity of Elements and Size of the range .

More information about here .

    
27.06.2017 / 15:11