Exploratory Data Analysis
Exploratory Data Analysis
# -------------------------------------------------------------------
# Activate the file containing all functions
# You should modify the file location because it refers to my laptop
# -------------------------------------------------------------------
# --------------------------------------------------------
# Using function 1: Read the dataset using function call
# --------------------------------------------------------
# Set pointer to location of my data ( do not use setwd command for data
retrieval)
# Check contents
dim(data)
colnames(data)
head(data)
# ------------------------------------------
# Using R package to display large dataset
# Output visible only if output format is html
# --------------------------- --------------
library(DT)
datatable(data)
# --------------------------------------------------------
# Using function 3: Compute correlation using two columns
# from the dataset
# --------------------------------------------------------
X <- data$breastcancer
Y <- data$co2emissions
corXY <- correlation(X,Y)
corXY
# Result: NA
# This means computation of correlation is not possible because
# of the presence of Missing values
# Using function 5 and 2: Construct two sets of variables from the data
#process pairwise correlations by feeding the two sets to the 5th function
Pearsonr <- pairwiseCor(Set1,Set2,"pearson")
Spearmanr <- pairwiseCor(Set1,Set2,"spearman")
Pearsonr
Spearmanr
}
}
#Remark: Plots under double for loop will not appear without the pront command
# Using function 11: For a given set of correlation coefficients, Generate the
# corresponding raw data X and Y.
PlotHistDensity(Set1)
# Using function 12: For a given set of correlation coefficients, Generate the
# corresponding raw data X and Y.