Introduction to Data Processing in R

The next exercises are an introduction to Processing Data in R. We Start with raw data or unorganized data.

Data Entries in R.

To read or enter Data in R, It should be consider data numerical and Data Categorical.

Numerical :

   x<-c(2,1,2,3,4,5,5,4,4,4,4,4,2,2,1,3,4,5,2,2)

For Categorical Data:

  y<-c("Jan","feb","March")

Some Statistical calculations

Measure of the Center

THE MEAN:

    mean(x)
## [1] 3.15

The Median:

    median(x)
## [1] 3.5

Measure of Variation:

Calculating the variance

   var(x)
## [1] 1.713158

Calculating the Standard Deviation

     sd(x)
## [1] 1.308877

We can use “table function” to create a table of x.

    table(x)
## x
## 1 2 3 4 5 
## 2 6 2 7 3

Also, We can use prop.table(x) function to get proportion or percentages as decimals.

prop.table(x)
##  [1] 0.03174603 0.01587302 0.03174603 0.04761905 0.06349206 0.07936508
##  [7] 0.07936508 0.06349206 0.06349206 0.06349206 0.06349206 0.06349206
## [13] 0.03174603 0.03174603 0.01587302 0.04761905 0.06349206 0.07936508
## [19] 0.03174603 0.03174603

Quantiles and Percentiles

The main quantiles for x are:

quantile(x)
##   0%  25%  50%  75% 100% 
##  1.0  2.0  3.5  4.0  5.0

The summary function provides:

summary(x)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    1.00    2.00    3.50    3.15    4.00    5.00

Graphs and Plot

r plot(x,)

Creating an Histogram

    hist(x)

creating a Box_plot

boxplot(x)

Checking Normality:

qqnorm(x)