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.