#Step 1: Find path of data file and copy path (if using windows)
#Step 2: In the console below, type readClipboard()
#Step 3: Copy and paste path to the line below in quotes

#AUTOMATING PACKAGES NEEDED FOR ANALYSES--------------------------------------------------------------------
haspackage = require("datasets")
if (haspackage==FALSE){
  install.packages("datasets")
}
library(datasets)

#dataset is already pre-loaded
#original data:
data01 = iris
#original data without species added:
data02 = data01[c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width")]

#distance methods in R: the dist function ----------------------------------------------------------------

#a distance between variables in the data set:
variable_distance = dist(t(data02), method = "euclidean")
variable_distance
##              Sepal.Length Sepal.Width Petal.Length
## Sepal.Width      36.15785                         
## Petal.Length     28.96619    25.77809             
## Petal.Width      57.18304    25.86407     33.86473
flower_distance = dist(data02, method = "euclidean")
#quick graph of all the distances between each flower (index == which distance number)
plot(flower_distance)