## Histogram for all variables
hist(attitude$rating, breaks=10, labels=TRUE, main="Rating Histogram", col="red", xlab="Rating")
hist(attitude$complaints, breaks=10, labels=TRUE, main="Complaints Histogram", col="yellow", xlab="Complaints")
hist(attitude$privileges, breaks=10, labels=TRUE, main="Privileges Histogram", col="purple", xlab="Privileges")
hist(attitude$learning, breaks=10, labels=TRUE, main="Learning Histogram", col="black", xlab="Learning")
hist(attitude$raises, breaks=10, labels=TRUE, main="Raises Histogram", col="green", xlab="Raises")
hist(attitude$critical, breaks=10, labels=TRUE, main="Critical Histogram", col="pink", xlab="Critical")
hist(attitude$advance, breaks=10, labels=TRUE, main="Advance Histogram", col="orange", xlab="Advance")
## Boxplot & Whisker Plot for each variable
boxplot(x=attitude$rating, main="Rating", frame.plot=FALSE)
boxplot(x=attitude$complaints, main="Complaints", frame.plot=FALSE)
boxplot(x=attitude$privileges, main="Privileges", frame.plot=FALSE)
boxplot(x=attitude$learning, main="Learning", frame.plot=FALSE)
boxplot(x=attitude$raises, main="Raises", frame.plot=FALSE)
boxplot(x=attitude$critical, main="Critical", frame.plot=FALSE)
boxplot(x=attitude$advance, main="Advance", frame.plot=FALSE)
##Box Plot for all variables
boxplot(x=attitude, main="Box Plot", frame.plot=FALSE)
## Scatter plot for all variables, cant use rating as thats what we are comparing as the main outcome variable.
plot(x=attitude$complaints , y=attitude$rating , frame.plot=FALSE , xlab="# of Complaints",ylab= "Rating Score")
plot(x=attitude$privileges , y=attitude$rating , frame.plot=FALSE , xlab="Privilege Score", ylab= "Rating Score")
plot(x=attitude$learning , y=attitude$rating , frame.plot=FALSE , xlab="Learing Score",ylab= "Rating Score")
plot(x=attitude$raises , y=attitude$rating , frame.plot=FALSE , xlab="# Raises",ylab= "Rating Score")
plot(x=attitude$critical , y=attitude$rating , frame.plot=FALSE , xlab="Critical", ylab= "Rating Score")
plot(x=attitude$advance , y=attitude$rating , frame.plot=FALSE , xlab="Advance", ylab= "Rating Score")
##Question 2 (Using Undergrad dataset)
#Pulling dataset
undergrad <- read.csv("~/undergrad.csv")
# Rename the 3 columns
names(undergrad)[2] <- "excel"
names(undergrad)[4] <- "statistics"
names(undergrad)[5] <- "programming"
excel <- undergrad$excel
statistics <- undergrad$statistics
programming <- undergrad$programming
#Look at Raw values through tables
table(excel)
## excel
## Agree Somewhat agree Strongly Agree
## 9 3 27
table(statistics)
## statistics
## Agree Disagree
## 1 13 1
## Neither agree or disagree Somewhat agree Strongly Agree
## 2 7 15
table(programming)
## programming
## Agree Disagree Neither agree or disagree
## 12 1 5
## Somewhat agree Somewhat disagree Strongly Agree
## 6 2 13
#Create Ordered Factor Variables
excel_order <- ordered(x=excel, levels=c("Strongly disagree","Disagree","Somewhat disagree","Neither agree or disagree","Somewhat agree","Agree","Strongly Agree"))
statistics_order <- ordered(x=statistics, levels=c("Strongly disagree","Disagree","Somewhat disagree","Neither agree or disagree","Somewhat agree","Agree","Strongly Agree"))
programming_order <-ordered(x=programming, levels=c("Strongly disagree","Disagree","Somewhat disagree","Neither agree or disagree","Somewhat agree","Agree","Strongly Agree"))
# KEY FOR CHARTS (Extra)
Number <- c(1,2,3,4,5,6,7)
Label <-c("Strongly disagree","Disagree","Somewhat disagree","Neither agree or disagree","Somewhat agree","Agree","Strongly Agree")
key <- data.frame(Number,Label)
key
## Number Label
## 1 1 Strongly disagree
## 2 2 Disagree
## 3 3 Somewhat disagree
## 4 4 Neither agree or disagree
## 5 5 Somewhat agree
## 6 6 Agree
## 7 7 Strongly Agree
#Creating Histogram
hist(as.numeric(excel_order), main="Excel Histogram", xlab="Bins by response category", col="red", labels=TRUE, breaks=7)
hist(as.numeric(statistics_order), main="Statistic Histogram",xlab="Bins by response category", col="red", labels=TRUE, breaks=7)
hist(as.numeric(programming_order), main="Programming Histogram",xlab="Bins by response category", col="red", labels=TRUE, breaks=7)