From a53777ba2bc17592f955248b7a61f4b9f0b4c984 Mon Sep 17 00:00:00 2001 From: Nihat Aliyev Date: Fri, 26 Nov 2021 16:16:03 -0500 Subject: [PATCH] tasks --- task1.r | 6 ++++++ task2.r | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 task1.r create mode 100644 task2.r diff --git a/task1.r b/task1.r new file mode 100644 index 0000000..ed9bc32 --- /dev/null +++ b/task1.r @@ -0,0 +1,6 @@ +# This data show number of quakes greater than the magnitude 7 from 1900 to 2000. We hae slightly less number of powerful earhtqquakes nowadays. +quakes<-read.table("https://seattlecentral.edu/qelp/sets/039/s039.txt", sep="\t", header=T) +names(quakes) = c("years","earthquakes") +reg1 <- lm(years~earthquakes,data=quakes) +with(quakes,plot(years,earthquakes)) +abline(reg1) diff --git a/task2.r b/task2.r new file mode 100644 index 0000000..22934d3 --- /dev/null +++ b/task2.r @@ -0,0 +1,17 @@ +library(ggplot2) +data <- read.table(file = "data.txt", header = T, sep = ",", stringsAsFactors = FALSE) + +ggplot(data, aes(x = region, y = observations)) + + stat_summary(fun = mean, geom = "bar") + + xlab(“region") + + ylab(“observations") + + theme_classic() + +ggplot(data = data,aes(x = region, y = observations)) + + geom_point() + + geom_jitter() + xlab(“region") + + ylab(“observations") + + theme_classic() + +# Barplot does not show us the great variance in diffrent regions here. SInce means are very similar we might be deceived. Jitterplot shows us the spread of clusters which gives us more information.