# use install.packages FIRST TIME ONLY
update.packages(
params$package_location,
repos=NULL,
type="source"
)
library(irisproject)
library(dplyr)
library(ggplot2)
for (p in names(params)) {
print(paste0(p, ': ', params[[p]]))
}
## [1] "package_location: ./irisproject/"
## [1] "convert_cm: TRUE"
## [1] "plot_pairs_of: Length.Ratio, Width.Ratio, Circumference, Species"
head(iris)
## Sepal.Length Sepal.Width Petal.Length Petal.Width Species
## 1 5.1 3.5 1.4 0.2 setosa
## 2 4.9 3.0 1.4 0.2 setosa
## 3 4.7 3.2 1.3 0.2 setosa
## 4 4.6 3.1 1.5 0.2 setosa
## 5 5.0 3.6 1.4 0.2 setosa
## 6 5.4 3.9 1.7 0.4 setosa
Data manipulation steps:
if (params$convert_cm) {
iris <- iris %>%
convert_measurements(1:4)
}
iris <- iris %>%
compute_ratios() %>%
compute_circumference()
head(iris)
## Sepal.Length Sepal.Width Petal.Length Petal.Width Species Length.Ratio Width.Ratio Circumference
## 1 2.007874 1.377953 0.5511811 0.07874016 setosa 3.642857 17.50 12.61584
## 2 1.929134 1.181102 0.5511811 0.07874016 setosa 3.500000 15.00 12.12111
## 3 1.850394 1.259843 0.5118110 0.07874016 setosa 3.615385 16.00 11.62637
## 4 1.811024 1.220472 0.5905512 0.07874016 setosa 3.066667 15.50 11.37900
## 5 1.968504 1.417323 0.5511811 0.07874016 setosa 3.571429 18.00 12.36848
## 6 2.125984 1.535433 0.6692913 0.15748031 setosa 3.176471 9.75 13.35795
Pairs plot of select variables
plot_pairs_of <- strsplit(params$plot_pairs_of, ",")[[1]] %>% trimws()
Variables included:
pairs(iris[,plot_pairs_of])
Plot of circumference and length ratio by species
iris %>% ggplot(aes(
x = Circumference,
y = Length.Ratio,
color = Species
)) +
geom_point() +
theme_classic() +
theme(
legend.position = 'top',
legend.justification = 'left'
)