hemlock_data <- read_excel("./data/18/hemlock.xlsx")
str(hemlock_data)
Classes 'tbl_df', 'tbl' and 'data.frame': 98 obs. of 11 variables:
$ Stand : chr "Athol 1" "Athol 2" "Athol 4" "Athol 6" ...
$ Year : num 2003 2003 2003 2003 2004 ...
$ Longitude : num -72.2 -72.2 -72.2 -72.2 -72.1 ...
$ Latitude : num 42.5 42.5 42.5 42.6 42.6 ...
$ Live BA : num 36.3 31.2 35.9 32.6 23 ...
$ Dead Hem BA : num 0.46 0.46 0 0 0 2.87 0 0 0 1.15 ...
$ Hem Vigor : num 1.6 1.18 1.47 1.86 1.25 1.9 1.91 1.56 1 1.81 ...
$ Hem Den : num 1450 1250 900 725 600 725 825 450 400 925 ...
$ Dead Hem Den : num 50 50 0 50 0 150 50 50 0 100 ...
$ Tree Den : num 2125 1725 1700 1100 1075 ...
$ Borer Density: num 0 0 0 0 0 0 0 0 0 0 ...
hemlock_sites <- read_excel("./data/18/hemlock.xlsx", sheet=2)
str(hemlock_sites)
Classes 'tbl_df', 'tbl' and 'data.frame': 111 obs. of 11 variables:
$ Stand : chr "Athol 1" "Athol 2" "Athol 3" "Athol 4" ...
$ Year : num 2003 2003 2003 2003 2003 ...
$ Mapped Code: chr "A" "A" "A" "B" ...
$ Aspect : num 213.2 357 292.5 80.5 227.5 ...
$ Slope : num 3.8 27.83 23.83 8.78 12.17 ...
$ Longitude : num -72.2 -72.2 -72.2 -72.2 -72.2 ...
$ Latitude : num 42.5 42.5 42.6 42.5 42.6 ...
$ Elevation : num 269 220 231 247 233 ...
$ Area : num 35.8 36.6 33.7 94.7 40.7 ...
$ Humus : num 9.9 5.92 5.58 6.89 3.71 5.25 7.33 12.4 6.75 8.85 ...
$ Logged : num 1 1 1 1 1 1 1 0 1 1 ...
nrow(hemlock_data)
[1] 98
nrow(hemlock_sites)
[1] 111
Creates new Data with rows that exist in both data sets
hem_inner <- inner_join(hemlock_data, hemlock_sites)
Joining, by = c("Stand", "Year", "Longitude", "Latitude")
nrow(hemlock_data)
[1] 98
nrow(hemlock_sites)
[1] 111
nrow(hem_inner)
[1] 87
hem_left <- left_join(hemlock_data, hemlock_sites)
Joining, by = c("Stand", "Year", "Longitude", "Latitude")
nrow(hem_left)
[1] 98
hem_right <- right_join(hemlock_data, hemlock_sites)
Joining, by = c("Stand", "Year", "Longitude", "Latitude")
nrow(hem_right)
[1] 111
hem_full <- full_join(hemlock_data, hemlock_sites)
Joining, by = c("Stand", "Year", "Longitude", "Latitude")
nrow(hem_full)
[1] 122
hem_semi <- semi_join(hemlock_data, hemlock_sites)
Joining, by = c("Stand", "Year", "Longitude", "Latitude")
nrow(hem_semi)
[1] 87
hem_anti <- anti_join(hemlock_data, hemlock_sites)
Joining, by = c("Stand", "Year", "Longitude", "Latitude")
nrow(hem_anti)
[1] 11