Through STAT 385 my abilities within R have increased significantly. I had some experience with R before the class but have become much more capable this semester. Here is some of the code I have written in R.
Here is a function I wrote to calculate mortgage payments
mortgage_num <- function(m, p, r){ outcome <- sum((log((r/((m/p)-r))+1))/log(1+r)) ceiling(outcome)
This code helps find the confirmed cases of Coronavirus in the US
virus <- read.csv(file = “https://nkha149.github.io/stat385-sp2020/files/data/coronavirus-2020-01-26.csv") str(virus) virus[virus$Country == “United States”, ]
confirmed <- virus[virus$Date.last.updated == ‘1/26/2020 11:00 AM’,c(2,3,4,5) ] print(confirmed)
iris
hist(x = iris$Sepal.Length, main = “Histogram of Sepal Length”, xlab = “Length”)
plot(x = iris$Sepal.Length, y = iris$Sepal.Width, main = “Sepal Length vs. Sepal Width”, xlab = “Sepal Length”, ylab = “Sepal Width”)
plot(x = iris$Sepal.Length, y = iris$Sepal.Width, main = “Sepal Length vs. Sepal Width”, xlab = “Sepal Length”, ylab = “Sepal Width”, col = iris$Species)
legend(x="topright”, legend = levels(iris$Species), col=c(“green”,“red”,“blue”), pch=1)
hist(x = iris$Sepal.Length, main = “Histogram of Sepal Length”, xlab = “Sepal Length”, breaks = 15, border = “dodgerblue”, probability = TRUE, ylim = c(0, 0.65), xlim = c(4, 8.2))
box()
grid()
sepal_mean = mean(iris$Sepal.Length)
abline(v = sepal_mean, col = “purple”)
faithful
faith_hist <- hist(x = faithful$eruptions ,main="Histogram of Old Faithful Geyser Eruption Time”, xlab = “Eruption Time (mins)", breaks = 18, border = “blue”, probability = TRUE)
lines(density(faithful$eruptions), lwd=2,col = “orange”)