This is an rmarkdown to analyze….
Here I will load my datatable.
Species | Individual.identification | Song.frequency |
---|---|---|
Phyllomedusa nordestina | 1 | 0.067802649 |
Phyllomedusa nordestina | 2 | 0.376210208 |
Phyllomedusa nordestine | 3 | 0.570607225 |
Phyllomedusa nordestina | 4 | 0.617220961 |
Phyllomedusa nordestina | 5 | 0.377619119 |
Phyllomedusa hypochondrialis | 6 | 0.823879493 |
Phyllomedusa hypochondrialis | 7 | 0,120265434422197 |
Phyllomedusa hypochondrialis | 8 | 0.608162724 |
Phyllomedusa hypochondrialis | 9 | 0,782765448936129 |
Phyllomedusa Hypochondrialis | 10 | 0.162430322 |
Remove trailing and leading space
## [1] "Phyllomedusa nordestina"
## [2] "Phyllomedusa nordestina"
## [3] "Phyllomedusa nordestine"
## [4] "Phyllomedusa nordestina"
## [5] " Phyllomedusa nordestina"
## [6] " Phyllomedusa hypochondrialis"
## [7] "Phyllomedusa hypochondrialis"
## [8] "Phyllomedusa hypochondrialis"
## [9] "Phyllomedusa hypochondrialis "
## [10] "Phyllomedusa Hypochondrialis"
## [1] "Phyllomedusa nordestina"
## [2] "Phyllomedusa nordestina"
## [3] "Phyllomedusa nordestine"
## [4] "Phyllomedusa nordestina"
## [5] "Phyllomedusa nordestina"
## [6] "Phyllomedusa hypochondrialis"
## [7] "Phyllomedusa hypochondrialis"
## [8] "Phyllomedusa hypochondrialis"
## [9] "Phyllomedusa hypochondrialis"
## [10] "Phyllomedusa Hypochondrialis"
Transform one or more spaces into one
## [1] "Phyllomedusa nordestina" "Phyllomedusa nordestina"
## [3] "Phyllomedusa nordestine" "Phyllomedusa nordestina"
## [5] "Phyllomedusa nordestina" "Phyllomedusa hypochondrialis"
## [7] "Phyllomedusa hypochondrialis" "Phyllomedusa hypochondrialis"
## [9] "Phyllomedusa hypochondrialis" "Phyllomedusa Hypochondrialis"
What names are still wrong?
## [1] "Phyllomedusa nordestina" "Phyllomedusa nordestine"
## [3] "Phyllomedusa hypochondrialis" "Phyllomedusa Hypochondrialis"
Change misspelling
mydata$Species[mydata$Species == "Phyllomedusa nordestine"] <- "Phyllomedusa nordestina"
unique(mydata$Species)
## [1] "Phyllomedusa nordestina" "Phyllomedusa hypochondrialis"
## [3] "Phyllomedusa Hypochondrialis"
mydata$Species[mydata$Species == "Phyllomedusa Hypochondrialis"] <- "Phyllomedusa hypochondrialis"
unique(mydata$Species)
## [1] "Phyllomedusa nordestina" "Phyllomedusa hypochondrialis"
Change decimal separator for dot
## [1] "0.067802649" "0.376210208" "0.570607225"
## [4] "0.617220961" "0.377619119" "0.823879493"
## [7] "0,120265434422197" "0.608162724" "0,782765448936129"
## [10] "0.162430322"
mydata$Song.frequency <- gsub(",", "\\.", mydata$Song.frequency)
# After running the code
mydata$Song.frequency
## [1] "0.067802649" "0.376210208" "0.570607225"
## [4] "0.617220961" "0.377619119" "0.823879493"
## [7] "0.120265434422197" "0.608162724" "0.782765448936129"
## [10] "0.162430322"
Change song frequency to number
## [1] 0.06780265 0.37621021 0.57060723 0.61722096 0.37761912 0.82387949
## [7] 0.12026543 0.60816272 0.78276545 0.16243032
Here the code will run a t-test
##
## Welch Two Sample t-test
##
## data: Song.frequency by Species
## t = 0.54463, df = 6.8215, p-value = 0.6033
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.3284385 0.5236558
## sample estimates:
## mean in group Phyllomedusa hypochondrialis
## 0.4995007
## mean in group Phyllomedusa nordestina
## 0.4018920