From 7e5d1c536a320049971f5bd91a21b7ded7d054e1 Mon Sep 17 00:00:00 2001 From: SilverHairtail <114496700+SilverHairtail@users.noreply.github.com> Date: Thu, 17 Nov 2022 19:35:50 -0500 Subject: [PATCH 1/2] Add files via upload --- Exercise09.R | 23 +++++++++++++++++++++++ data_for_task_1.txt | 21 +++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 Exercise09.R create mode 100644 data_for_task_1.txt diff --git a/Exercise09.R b/Exercise09.R new file mode 100644 index 0000000..20a4c40 --- /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 From c364f76aaea54692e76b84de25d48f1c22a578c7 Mon Sep 17 00:00:00 2001 From: SilverHairtail <114496700+SilverHairtail@users.noreply.github.com> Date: Thu, 17 Nov 2022 19:38:17 -0500 Subject: [PATCH 2/2] Add files via upload --- Exercise09.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Exercise09.R b/Exercise09.R index 20a4c40..74d5149 100644 --- a/Exercise09.R +++ b/Exercise09.R @@ -11,7 +11,7 @@ ggplot(data = data_1, #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, + stat_summary(fun.y = mean, geom = "bar") #scatter plot of all of the observations ggplot(data = data_2,