-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathRunningDataEDA.Rmd
More file actions
103 lines (79 loc) · 2.88 KB
/
RunningDataEDA.Rmd
File metadata and controls
103 lines (79 loc) · 2.88 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
---
title: "LandCover EDA"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(raster)
library(sp)
library(rgdal)
library(sf)
library(ggplot2)
library(dplyr)
library(reshape2)
```
```{r}
#function for reading land cover data
read_land_cover <- function(directory){
return(raster(directory))
}
#Jessica
jessica_tif <- "C:\\Users\\jeske\\Desktop\\capstone\\data\\tcma_classnames_updated\\TCMA_ClassNames_Updated\\tcma_lc_finalv1.tif.tif"
land_cover <- read_land_cover(jessica_tif)
getwd()
# Ann
ann_tif <- "C:\\Users\\amuud\\OneDrive\\Desktop\\capstone data\\tcma_lc_finalv1.tif"
#Serene
serene_tif <- "/Users/serenelee/Capstone/TCMA_ClassNames_Updated/tcma_lc_finalv1.tif"
land_cover <- read_land_cover(serene_tif)
# This is Julia's changes
```
```{r}
#function for reading land use data
read_land_use <- function(directory){
return(st_read(directory))
}
#Jessica respective directories
jessica_sf <- "C:\\Users\\jeske\\Desktop\\capstone\\data\\shp_plan_generl_lnduse_historical\\GeneralizedLandUseHistorical.shp"
land_use <- read_land_use(jessica_sf)
#Ann
#Serene
serene_sf <- "/Users/serenelee/Capstone/shp_plan_generl_lnduse_historical/GeneralizedLandUseHistorical.shp"
land_use <- read_land_use(serene_sf)
ann_sf <- "C:\\Users\\amuud\\OneDrive\\Desktop\\land use data\\GeneralizedLandUseHistorical.shp"
#can call in console
#land_use <- read_land_use(jessica_sf)
```
```{r}
potential_forest <- land_use %>%
filter(Dscrpt2016 == "Park, Recreational, or Preserve" |
Dscrpt2016 == "Undeveloped")
```
```{r}
landuse_percentages <- landuse_filtered %>%
rename(type = DSCRPT2016, `NA` = VALUE_0, `Grass/Shrub` = VALUE_1, `Bare Soil` = VALUE_2, Buildings= VALUE_3, `Roads/Paved Surfaces` = VALUE_4, `Lakes/Ponds` = VALUE_5, `Deciduous Tree Canopy` = VALUE_6, `Coniferous Tree Canopy` = VALUE_7, Agriculture = VALUE_8, `Emergent Wetland` = VALUE_9, `Forested/Shrub Wetland` = VALUE_10, River = VALUE_11, Extraction = VALUE_12) %>%
melt(id.vars = c("type", "OBJECTID")) %>%
mutate(percent = case_when(
type == "Park, Recreational, or Preserve" ~ (value/747410768)*100,
type == "Undeveloped" ~ (value/1702916156)*100
))
#to get sums per type:
# landuse_percentages %>%
# group_by(type) %>%
# summarize(sum(value))
#total park etc: 747410768
#total undeveloped: 1702916156
colnames(landuse_filtered)
```
"1" = "Grass/Shrub",
"2" = "Bare Soil",
"3" = "Buildings",
"4" = "Roads/Paved Surfaces",
"5" = "Lakes/Ponds",
"6" = "Deciduous Tree Canopy",
"7" = "Coniferous Tree Canopy",
"8" = "Agriculture",
"9" = "Emergent Wetland",
"10" = "Forested/Shrub Wetland",
"11" = "River",
"12" = "Extraction"))