Docsity

Descriptive Statistics with R: A Practical Guide, Schemes and Mind Maps of Data Mining

Partial preview of the text

Download Descriptive Statistics with R: A Practical Guide and more Schemes and Mind Maps Data Mining in PDF only on Docsity!

Descriptive Statistics

Descriptive statistics

Descriptive statistics helps to simplify large amounts of data sensibly. This section will look at measures of central tendency and measure of spread. For illustrative purposes, we’ll use variables from the Iris dataset( you can download it from this link( https://www.kaggle.com/datasets/uciml/iris ) Our focus will be on SepalLenghtCM, SepalWidthCM, PeatLengthCM, and PetalLengthCm).

Descriptive statistics

We can use the summary() function in the base installation to obtain descriptive statistics. An example is presented in the following listing.

Annotating datasets

Data analysts typically annotate datasets to make the results easier to interpret. Typically annotation includes adding descriptive labels to variable names and value labels to the codes used for categorical variables. For example, for the variable age, you might want to attach the more descriptive label “Age at hospitalization (in years).” For the variable gender coded 1 or 2, you might want to associate the labels “male” and “female.” Variable labels : names(mydata)[2] <- "new“

To see the summery of the structure of data set

str(mydata)

Finding the Standard deviation of the Attribute

s<-mydata$SepalLengthCm

sd(s)

Selecting Random N Rows using dplyr

sample_n(mydata,3)

Selecting specific Variables

mydata2 = select(mydata, SepalLengthCm )

Counting number of Null values in each column

mydata<- read.csv("D:/data.csv",header = TRUE,sep = ",") mydata colSums(is.na(mydata))

Finding the specific row number of Null values.

which(is.na(mydata$SepalLengthCm))