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
23 changes: 23 additions & 0 deletions Exercise09.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
library('ggplot2')

##task 1
data_1 <- read.table("data_for_task_1.txt",header = TRUE,sep = "\t")
ggplot(data = data_1,
aes(x = x, y = y)) +
geom_point() +
stat_smooth(method="loess")

##task 2
#barplot of the means of the four populations
data_2 <- read.table("data.txt",header = TRUE,sep = ",")
ggplot(data_2, aes(x = region, y = observations)) +
stat_summary(fun.y = mean,
geom = "bar")
#scatter plot of all of the observations
ggplot(data = data_2,
aes(x = region, y = observations)) +
geom_jitter()
#Do the bar and scatter plots tell you different stories? Why?
#Yes, they do. The bar plot shows the mean of each group, which helps us to
#know about the overall value and central tendency of them; the scatter plot
#shows the distribution of data inside the group.
21 changes: 21 additions & 0 deletions data_for_task_1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
x y
0.0944615 1.820397
1.5610722 2.236232
2.8582951 4.511865
4.2315074 4.110922
5.9662839 7.328110
6.4333511 7.801370
7.6254131 8.534576
7.8351134 8.613648
9.3212257 11.250261
9.4099321 10.831325
11.5185412 13.283047
12.6260518 12.919002
13.3778587 14.740210
13.9052150 14.424189
15.0510354 17.099260
16.1385003 17.204369
17.4947985 17.985392
18.8766295 19.063242
18.4800961 20.776075
19.6601686 21.306753