How to Perform Univariate Analysis in R
- R-PROGRAMMING
Univariate analysis involves summarizing and visualizing a single variable in a dataset. This involves calculating statistical values, calculate frequency table and plotting charts.
The following method shows how you can do it with syntax.
Method 1: Calculate Statistical Values
# Calculate mean mean(df$column) # Calculate median median(df$column) # Calculate difference between max and min value max(df$column)-min(df$column) # Calculate IQR IQR(df$column) # Calculate standard deviation sd(df$column) Method: Create Frequency Table
table(df$column) Method: Plotting Chart