-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathiris_plot.R
More file actions
39 lines (25 loc) · 949 Bytes
/
iris_plot.R
File metadata and controls
39 lines (25 loc) · 949 Bytes
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
# LOAD DATASETS PACKAGES ###################################
library(datasets) # Load/unload base packages manually
# LOAD DATA ################################################
head(iris)
# PLOT DATA WITH PLOT() ####################################
?plot # Help for plot()
plot(iris$Species) # Categorical variable
plot(iris$Petal.Length) # Quantitative variable
plot(iris$Species, iris$Petal.Width) # Cat x quant
plot(iris$Petal.Length, iris$Petal.Width) # Quant pair
plot(iris) # Entire data frame
plot(iris$Species, iris$Sepal.Length,
main = "Iris: Sepal Length by zargham",
col = "red",
xlab = "Iris Species",
ylab = "Sepal Length"
)
# CLEAN UP #################################################
# Clear packages
detach("package:datasets", unload = TRUE)
# Clear plots
dev.off() # But only if there IS a plot
# Clear console
cat("\014") # ctrl+L
# Clear mind :)