Load libraries
library(agricolae)
library(tidyverse)
Load csv file
irisdata <- read.csv("irisdata.csv")
We can also import data directly from the website as follows:
irisdata <- read.csv('https://raw.githubusercontent.com/rbiology/rbiology.github.io/master/_data/irisdata.csv')
Now, we can check the structure of this dataset by:
str(irisdata)
## Classes 'tbl_df', 'tbl' and 'data.frame': 150 obs. of 5 variables:
## $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ...
## $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ...
## $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ...
## $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ...
## $ Species : chr "setosa" "setosa" "setosa" "setosa" ...
## - attr(*, "spec")=List of 2
## ..$ cols :List of 5
## .. ..$ Sepal.Length: list()
## .. .. ..- attr(*, "class")= chr "collector_double" "collector"
## .. ..$ Sepal.Width : list()
## .. .. ..- attr(*, "class")= chr "collector_double" "collector"
## .. ..$ Petal.Length: list()
## .. .. ..- attr(*, "class")= chr "collector_double" "collector"
## .. ..$ Petal.Width : list()
## .. .. ..- attr(*, "class")= chr "collector_double" "collector"
## .. ..$ Species : list()
## .. .. ..- attr(*, "class")= chr "collector_character" "collector"
## ..$ default: list()
## .. ..- attr(*, "class")= chr "collector_guess" "collector"
## ..- attr(*, "class")= chr "col_spec"
The dimension of the dataset is:
dim(irisdata)
## [1] 150 6
This shows that there are 150 rows and 5 columns in the dataset
<– Click here to go to the previous tutorial Click here to go to the next tutorial –>