@@ -6,3 +6,118 @@ neighb4comp(d=d)
6
6
neighb4comp(d=d)
7
7
quit()
8
8
n
9
+ d <- read.table(file="/home/evan/Documents/chicago/dssg-landbank-project/analysis/single_family_defaults_by_ca_over_time.csv",header = FALSE)
10
+ d <- read.table(file="/home/evan/Documents/chicago/dssg-landbank-project/analysis/single_family_defaults_by_ca_over_time.csv",header = FALSE)
11
+ d <- read.table(file="/home/evan/Documents/chicago/dssg-landbank-project/analysis/single_family_defaults_by_ca_over_time.csv",header = FALSE,sep = ",")
12
+ head(d)
13
+ sfneighb4comp(d=d)
14
+ library(ggplot)
15
+ library(ggplot2)
16
+ sfneighb4comp(d=d)
17
+ head(d)
18
+ quit()
19
+ n
20
+ list.files()
21
+ list.files(,pattern = pattern = "^[CA]", full.names = TRUE, ignore.case = TRUE)
22
+ list.files(,pattern = "^[CA]", full.names = TRUE, ignore.case = TRUE)
23
+ d <- read.table(file="/home/evan/Documents/chicago/dssg-landbank-project/analysis/CA_ptype_median_bldg_size.csv",header = TRUE,sep=",")
24
+ d[1:10,]
25
+ d[1:20,]
26
+ d[1:30,]
27
+ d[d['PTYPE2011']=='SINGLE FAMILY',]
28
+ d1 <- d[d['PTYPE2011']=='SINGLE FAMILY',]
29
+ community_area <- str_trim(d[,1],side = "both")
30
+ community_area <- str_trim(d[,1],side = "both")
31
+ d1<-data.frame(community_area,d1[,-1])
32
+ community_area <- str_trim(d1[,1],side = "both")
33
+ d1<-data.frame(community_area,d1[,-1])
34
+ d1
35
+ d1[1:100,]
36
+ community_area==is.character
37
+ str(community_area)
38
+ d[446,]
39
+ d[446,1] <- 'OHare'
40
+ levels(d[,1])
41
+ levels(d[,1])[60:63] <- c("OHare1","OHare2","OHare3","OHare4")
42
+ community_area_labels<- str_trim(levels(d[,1]),side = "both")
43
+ community_area_labels
44
+ community_area_f <- factor(as.numeric(community_area),levels = 1:86,labels = community_area_labels)
45
+ community_area_f
46
+ as.numeric(community_area)
47
+ community_area
48
+ community_area[59]
49
+ community_area[59] <- "OHare"
50
+ d1
51
+ nrow(d1)
52
+ length(community_area)
53
+ d1 <- data.frame(community_area,d1[,-1])
54
+ head(d1)
55
+ library(ggplot2)
56
+ p <- ggplot(data=d1,aes(community_area,sqft_bldg_11))+geom_bar()
57
+ print(p)
58
+ p <- ggplot(data=d1,aes(community_area)+geom_bar()+stat_bin()
59
+ )
60
+ p <- ggplot(data=d1,aes(community_area))+geom_bar()+stat_bin()
61
+ print(p)
62
+ p <- ggplot(data=d1,aes(community_area,sqft_bldg_11,fill=sqft_bldg_11))+geom_bar()
63
+ print(p)
64
+ p <- ggplot(data=d1,aes(community_area,fill=sqft_bldg_11),stat="bin")+geom_bar()
65
+ print(p)
66
+ p <- ggplot(data=d1,aes(community_area,fill=sqft_bldg_11),stat="identity-")+geom_bar()
67
+ print(p)
68
+ p <- ggplot(data=d1,aes(community_area,fill=sqft_bldg_11),stat="identity")+geom_bar()
69
+ print(p)
70
+ p <- ggplot(data=d1,aes(community_area,sqft_bldg_11),stat="identity")+geom_bar()
71
+ print(p)
72
+ p <- ggplot(data=d1,aes(x=community_area,y=sqft_bldg_11),stat="identity")+geom_bar()
73
+ print(p)
74
+ p <- ggplot(data=d1,aes(x=community_area,y=sqft_bldg_11,fill=community_area),stat="identity")+geom_bar()
75
+ print(p)
76
+ d <- read.table(file="/home/evan/Documents/chicago/dssg-landbank-project/analysis/CA_ptype_median_bldg_psf.csv",header = TRUE,sep=",")
77
+ head(d)
78
+ d1 <- d[d['PTYPE2011']=='SINGLE FAMILY',]
79
+ nrow(d1)
80
+ nrow(d)
81
+ nrow(d1)
82
+ nrow(d2)
83
+ nrow(d3)
84
+ d1 <- d[d['PTYPE2011']=='SINGLE FAMILY',]
85
+ colnames(d1)
86
+ d2 <- data.frame(community_area,d1["sqft_bldg_11","bldg_assmt_11_psf","sqft_land_11","land_assmt_11_psf"])
87
+ head(d2)
88
+ head(community_area)
89
+ d3 <- d1["sqft_bldg_11","bldg_assmt_11_psf","sqft_land_11","land_assmt_11_psf"]
90
+ d3 <- d1["sqft_bldg_11","bldg_assmt_11_psf","sqft_land_11"]
91
+ d3 <- d1[,c("sqft_bldg_11","bldg_assmt_11_psf","sqft_land_11","land_assmt_11_psf")]
92
+ head(d3)
93
+ d3 <- data.frame(community_area,d1[,c("sqft_bldg_11","bldg_assmt_11_psf","sqft_land_11","land_assmt_11_psf")])
94
+ head(d3)
95
+ library(plyr)
96
+ adply(d3,1,transform,singleFamSellPrice=((sqft_bldg_11*bldg_assmt_11_psf)+(sqft_land_11*land_assmt_11_psf)))
97
+ p <- ggplot(data = d,aes(singleFamSellPrice))+geom_boxplot()
98
+ print(p)
99
+ colnames(d)
100
+ p <- ggplot(data = d3,aes(singleFamSellPrice))+geom_boxplot()
101
+ print(p)
102
+ colnames(d3)
103
+ d3 <- adply(d3,1,transform,singleFamSellPrice=((sqft_bldg_11*bldg_assmt_11_psf)+(sqft_land_11*land_assmt_11_psf)))
104
+ p <- ggplot(data = d3,aes(singleFamSellPrice))+geom_boxplot()
105
+ print(p)
106
+ p <- ggplot(data = d3,aes(y=singleFamSellPrice))+geom_boxplot()
107
+ print(p)
108
+ p <- ggplot(data = d3,aes(x=community_area,y=singleFamSellPrice))+geom_boxplot()
109
+ print(p)
110
+ d3 <- data.frame(d3,"sigle_family")
111
+ head(d3)
112
+ d3[,1:(ncol(d3)-1)]
113
+ d3 <- data.frame(d3,housing_type="single_family")
114
+ head(d3)
115
+ d3 <- d3[,c(1:6,8)]
116
+ head(d3)
117
+ p <- ggplot(data = d3,aes(x=housing_type,y=singleFamSellPrice,fill=singleFamSellPrice))+geom_boxplot()
118
+ print(p)
119
+ p <- ggplot(data = d3,aes(x=housing_type,y=singleFamSellPrice))+geom_boxplot()
120
+ print(p)
121
+ colnames(d)
122
+ quit()
123
+ n
0 commit comments