This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
library(dplyr)
student <- ‘/Users/saitejaravulapalli/Documents/IUPUI_SEM 01/Intro to Statistic in R/DATA SET/student dropout.csv’ data <- read.csv(student, sep= “;”, header = TRUE)
group_1 <- data %>% group_by(Marital.status)
group_count1 <- group_1 %>% summarize(count1 = n())
total_count <- nrow(data)
group_count1 <- group_count1 %>% mutate(expected_probability = count1 / total_count)
print(group_count)
anomaly_1 <- group_count1 %>% filter(expected_probability == min(expected_probability))
print(anomaly_1)
data_with_anomaly_tag <- data %>% left_join(anomaly_1, by = “Marital.status”) %>% mutate(Anomaly_Tag = ifelse(expected_probability == min(expected_probability), “Anomaly”, “Normal”))
print(data_with_anomaly_tag)
group_2 <- data %>% group_by(Gender)
group_count2 <- group_2 %>% summarize(count2 = n())
total_count <- nrow(data)
group_count2 <- group_count2 %>% mutate(expected_probability = count2 / total_count)
print(group_count2)
anomaly_2 <- group_count2 %>% filter(expected_probability == min(expected_probability))
print(anomaly_2)
data_with_anomaly_tag <- data %>% left_join(anomaly_2, by = “Gender”) %>% mutate(Anomaly_Tag = ifelse(expected_probability == min(expected_probability), “Anomaly”, “Normal”))
print(data_with_anomaly_tag)
group_3 <- data %>% group_by(International)
group_count3 <- group_3 %>% summarize(count3 = n())
total_count <- nrow(data)
group_count3 <- group_count3 %>% mutate(expected_probability = count3 / total_count)
print(group_count3)
anomaly_3 <- group_count3 %>% filter(expected_probability == min(expected_probability))
print(anomaly_3)
data_with_anomaly_tag <- data %>% left_join(anomaly_3, by = “International”) %>% mutate(Anomaly_Tag = ifelse(expected_probability == min(expected_probability), “Anomaly”, “Normal”))
print(data_with_anomaly_tag)