-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.r
40 lines (24 loc) · 1.78 KB
/
test.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
df <- read.csv("iris.csv")
print("A few calculation comparing species:")
cat("\n")
print(paste("Setosa --- <sepal_length> = ", mean(df[df$species == "setosa",]$sepal_length)))
print(paste("Versicolor --- <sepal_length> = ", mean(df[df$species == "versicolor",]$sepal_length)))
print(paste("Virginica --- <sepal_length> = ", mean(df[df$species == "virginica",]$sepal_length)))
print("--------------------------------------------------")
print("--------------------------------------------------")
print("--------------------------------------------------")
print(paste("Setosa --- <sepal_width> = ", mean(df[df$species == "setosa",]$sepal_width)))
print(paste("Versicolor --- <sepal_width> = ", mean(df[df$species == "versicolor",]$sepal_width)))
print(paste("Virginica --- <sepal_width> = ", mean(df[df$species == "virginica",]$sepal_width)))
print("--------------------------------------------------")
print("--------------------------------------------------")
print("--------------------------------------------------")
print(paste("Setosa --- <petal_length> = ", mean(df[df$species == "setosa",]$petal_length)))
print(paste("Versicolor --- <petal_length> = ", mean(df[df$species == "versicolor",]$petal_length)))
print(paste("Virginica --- <petal_length> = ", mean(df[df$species == "virginica",]$petal_length)))
print("--------------------------------------------------")
print("--------------------------------------------------")
print("--------------------------------------------------")
print(paste("Setosa --- <petal_width> = ", mean(df[df$species == "setosa",]$petal_width)))
print(paste("Versicolor --- <petal_width> = ", mean(df[df$species == "versicolor",]$petal_width)))
print(paste("Virginica --- <petal_width> = ", mean(df[df$species == "virginica",]$petal_width)))