diff --git a/Exercise09.R b/Exercise09.R new file mode 100644 index 0000000..74d5149 --- /dev/null +++ b/Exercise09.R @@ -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. \ No newline at end of file diff --git a/data_for_task_1.txt b/data_for_task_1.txt new file mode 100644 index 0000000..e5ea5a0 --- /dev/null +++ b/data_for_task_1.txt @@ -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 \ No newline at end of file