Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions Exercise9.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#Elias Issa Exercise09

#Set Working Directory
setwd("/Users/elias/Downloads")
#Initialize ggplot2
library(ggplot2)

#Q1
#Load data set oxygen
oxygen <- read.table("Oxygen.txt", header= T, sep = "\t", stringsAsFactors=FALSE)


#Plot o2% against relative fluorescence and add a trend line, Standard error is false
ggplot(data=oxygen, aes(x = O2, y = RF)) + geom_point() +xlab("Oxygen (%)")+ylab("Relative Fluorescence")+theme_classic()+geom_smooth(se=F,method="lm")


#Q2
#Load data.txt
data <- read.table("data.txt", header= T, sep = ",", stringsAsFactors=FALSE)

#Plot bar chart of mean observations for each region
ggplot(data=data, aes(x = region, y = observations)) + geom_bar(position="dodge",stat="summary",fun= "mean") +xlab("Region")+ylab("Observations")+theme_classic()

#Plot scatterplot of observations for each region
ggplot(data=data, aes(x = region, y = observations)) + geom_point()+ geom_jitter() +xlab("Region")+ylab("Observations")+theme_classic()

#The bar and scatter plots tell different sotries as based on the bar plot the data seems very similar
#Based on the scatter plot the data is very different as they have different distributions with similar means
#This would be reflected in other analysis such as finding the standard deviations of the data
8 changes: 8 additions & 0 deletions Oxygen.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
O2 RF
0 1
5 1.147308782
10 1.300160514
15 1.451612903
20 1.542857143
25 1.768558952
30 1.956521739