-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path09_cluster_analysis_data_munging.R
50 lines (32 loc) · 1.81 KB
/
09_cluster_analysis_data_munging.R
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
# Working with the iso cluster analysis from ArcGIS
ndvi.86.cluster <- read.csv("./data/ndvi1986cluster.txt", colClasses=c("NULL", "NULL", NA, NA, NA ))
ndvi.11.cluster <- read.csv("./data/ndvi2011cluster.txt", colClasses=c("NULL", "NULL", NA, NA, NA ))
savi.86.cluster <- read.csv("./data/savi1986cluster.txt", colClasses=c("NULL", "NULL", NA, NA, NA ))
savi.11.cluster <- read.csv("./data/savi2011cluster.txt", colClasses=c("NULL", "NULL", NA, NA, NA ))
evi.86.cluster <- read.csv("./data/evi1986cluster.txt", colClasses=c("NULL", "NULL", NA, NA, NA ))
evi.11.cluster <- read.csv("./data/evi2011cluster.txt", colClasses=c("NULL", "NULL", NA, NA, NA ))
table(ndvi.86.cluster$iso1986_ndvi)
cluster86 <- merge( ndvi.86.cluster, savi.86.cluster, by = c("X", "Y"))
cluster86 <- merge( cluster86, evi.86.cluster, by = c("X", "Y"))
#additively combining scenes to create model classification
attach(cluster86)
cluster86$combo <- (iso1986_ndvi + isocluster2_1 + evi1986cluster_1) - 3 #Subtracting 4 b/c all ones would be non-shrubs and we want just the no. of models that predict shrub cover
detach(cluster86)
# 2011
cluster11 <- merge( ndvi.11.cluster, savi.11.cluster, by = c("X", "Y"))
cluster11 <- merge( cluster11, evi.11.cluster, by = c("X", "Y"))
#additively combining scenes to create model classification
attach(cluster11)
cluster11$combo <- (iso2011_ndvi + savi2011cluster_1 + evi2011cluster_1) - 3 #Subtracting 4 b/c all ones would be non-shrubs and we want just the no. of models that predict shrub cover
detach(cluster11)
# lets look at this jenk
table(cluster86$combo)
table(cluster11$combo)
#ndvi
table(cluster86$iso1986_ndvi)
table(cluster86$evi1986cluster_1)
table(cluster11$evi2011cluster_1)
table(cluster11$combo)
summary(cluster11)
# write.csv(cluster86, "isomodel_1986.csv")
# write.csv(cluster11, "isomodel_2011.csv")