chlc <- data %>%
mutate(ntot = n()) %>%
group_by(neighbourhood) %>%
mutate(nbar.tot = n()) %>%
mutate(percbar.tot = 100*nbar.tot/ntot) %>%
filter(calculated_host_listings_count>1)
chlc <- chlc %>%
mutate(ntot.filt = nrow(chlc)) %>%
mutate(nbar.filt = n()) %>%
mutate(percbartot.filt = 100*nbar.filt/ntot.filt) %>%
mutate(percbar.filt = 100*nbar.filt/nbar.tot) %>%
select(neighbourhood,ntot,nbar.tot,percbar.tot,ntot.filt,nbar.filt,percbartot.filt,percbar.filt) %>%
distinct()
a365 <- data %>%
mutate(ntot.A = n()) %>%
group_by(neighbourhood) %>%
mutate(nbar.tot.A = n()) %>%
mutate(percbar.tot.A = 100*nbar.tot.A/ntot.A) %>%
filter(availability_365>182)
a365 <- a365 %>%
mutate(ntot.filt.A = nrow(a365)) %>%
mutate(nbar.filt.A = n()) %>%
mutate(percbartot.filt.A = 100*nbar.filt.A/ntot.filt.A) %>%
mutate(percbar.filt.A = 100*nbar.filt.A/nbar.tot.A) %>%
select(neighbourhood,ntot.A,nbar.tot.A,percbar.tot.A,ntot.filt.A,nbar.filt.A,percbartot.filt.A,percbar.filt.A) %>%
distinct()
MERGE
multiprof <- merge(chlc,a365,all=TRUE)
multiprof[is.na(multiprof)] = 0
multiprof <- multiprof %>%
rename(
b.airbnb = neighbourhood,
)
merged <- read_excel("Z:/Il mio Drive/Dades_i_Docus_Habitatge_Airbnb/3_Dades_i_Resultats/Data Cluster/merged.xlsx")
rosetta_barrio <- read_delim("Z:/Il mio Drive/Dades_i_Docus_Habitatge_Airbnb/3_Dades_i_Resultats/Datos.Merged/rosetta.barrio.csv",
";", escape_double = FALSE, trim_ws = TRUE)
## Parsed with column specification:
## cols(
## Barri = col_character(),
## COD = col_double(),
## Barrio = col_character(),
## b.gencat = col_character(),
## b.airbnb = col_character()
## )
rosetta_barrio <- rosetta_barrio %>%
rename(
Codi = COD,
)
m.rose <- merge(rosetta_barrio, multiprof, by="b.airbnb", all = TRUE)
m.rose <- m.rose[,c(3,6:19)]
m.rose[is.na(m.rose)] = 0
merged.multiprof <- merge(merged,m.rose, by="Codi")
Codi: codigo barrio n.tot: listings totales n.bar.tot: listings por barrio percbar.tot: % listings barrio en el total de la ciudad ntot.filt: listing totales filtrados (calculated_host_listings_count>1) nbar.filt: listing totales por barrio filtrados por calculated_host_listings_count>1 percbartot.filt: % listings barrio (filtrados por calculated_host_listings_count>1) en el total listing (filtrados por calculated_host_listings_count>1) de la ciudad percbar.filt: (listing totales por barrio filtrados por calculated_host_listings_count>1)*100/listings por barrio
las variables que acaban "*.A" son: availability_365>182
#write.xlsx(merged.multiprof, file = "Z:/Il mio Drive/Dades_i_Docus_Habitatge_Airbnb/3_Dades_i_Resultats/Data Cluster/mergedmultiprof.xlsx", append=TRUE)
m.rose
## Codi ntot nbar.tot percbar.tot ntot.filt nbar.filt percbartot.filt
## 1 58 0 0 0.000000000 0 0 0.00000000
## 2 34 20428 43 0.210495398 13288 26 0.19566526
## 3 47 20428 2 0.009790484 13288 2 0.01505117
## 4 49 0 0 0.000000000 0 0 0.00000000
## 5 55 20428 8 0.039161935 13288 2 0.01505117
## 6 69 20428 202 0.988838849 13288 152 1.14388922
## 7 33 20428 153 0.748971999 13288 85 0.63967489
## 8 2 20428 1423 6.965929117 13288 984 7.40517760
## 9 70 20428 210 1.028000783 13288 131 0.98585190
## 10 59 20428 21 0.102800078 13288 11 0.08278146
## 11 32 20428 368 1.801448992 13288 215 1.61800120
## 12 64 20428 360 1.762287057 13288 244 1.83624323
## 13 37 20428 114 0.558057568 13288 64 0.48163757
## 14 65 20428 161 0.788133934 13288 88 0.66225166
## 15 29 20428 59 0.288819268 13288 38 0.28597231
## 16 62 20428 67 0.327981202 13288 29 0.21824202
## 17 5 20428 547 2.677697278 13288 343 2.58127634
## 18 35 20428 206 1.008419816 13288 110 0.82781457
## 19 66 20428 261 1.277658116 13288 163 1.22667068
## 20 11 20428 1112 5.443508909 13288 679 5.10987357
## 21 68 20428 488 2.388878011 13288 278 2.09211318
## 22 27 20428 232 1.135696103 13288 161 1.21161951
## 23 1 20428 1781 8.718425690 13288 1117 8.40608067
## 24 46 20428 32 0.156647738 13288 17 0.12793498
## 25 43 20428 41 0.200704915 13288 16 0.12040939
## 26 15 20428 290 1.419620129 13288 193 1.45243829
## 27 8 20428 1079 5.281965929 13288 796 5.99036725
## 28 3 20428 466 2.281182690 13288 281 2.11468995
## 29 16 20428 137 0.670648130 13288 79 0.59452137
## 30 42 0 0 0.000000000 0 0 0.00000000
## 31 7 20428 2099 10.275112591 13288 1689 12.71071644
## 32 36 20428 20 0.097904836 13288 7 0.05267911
## 33 14 20428 138 0.675543372 13288 86 0.64720048
## 34 48 20428 14 0.068533386 13288 5 0.03762793
## 35 13 20428 93 0.455257490 13288 54 0.40638170
## 36 12 20428 14 0.068533386 13288 9 0.06773028
## 37 20 20428 170 0.832191110 13288 96 0.72245635
## 38 9 20428 894 4.376346192 13288 588 4.42504515
## 39 52 20428 15 0.073428627 13288 7 0.05267911
## 40 6 20428 1101 5.389661249 13288 745 5.60656231
## 41 61 20428 80 0.391619346 13288 49 0.36875376
## 42 30 20428 102 0.499314666 13288 61 0.45906081
## 43 38 20428 35 0.171333464 13288 13 0.09783263
## 44 53 20428 10 0.048952418 13288 4 0.03010235
## 45 57 20428 16 0.078323869 13288 8 0.06020470
## 46 41 20428 10 0.048952418 13288 4 0.03010235
## 47 73 20428 81 0.396514588 13288 48 0.36122818
## 48 31 20428 1122 5.492461328 13288 703 5.29048766
## 49 67 20428 185 0.905619738 13288 123 0.92564720
## 50 19 20428 228 1.116115136 13288 144 1.08368453
## 51 50 20428 30 0.146857255 13288 15 0.11288380
## 52 24 20428 33 0.161542980 13288 22 0.16556291
## 53 40 20428 23 0.112590562 13288 9 0.06773028
## 54 63 20428 97 0.474838457 13288 44 0.33112583
## 55 21 20428 23 0.112590562 13288 13 0.09783263
## 56 45 20428 54 0.264343059 13288 18 0.13546057
## 57 71 20428 122 0.597219503 13288 62 0.46658639
## 58 60 20428 72 0.352457411 13288 33 0.24834437
## 59 10 20428 999 4.890346583 13288 679 5.10987357
## 60 39 20428 29 0.141962013 13288 16 0.12040939
## 61 26 20428 361 1.767182299 13288 269 2.02438290
## 62 25 20428 54 0.264343059 13288 31 0.23329320
## 63 72 20428 104 0.509105150 13288 52 0.39133052
## 64 4 20428 1273 6.231642843 13288 784 5.90006020
## 65 18 20428 394 1.928725279 13288 238 1.79108970
## 66 17 20428 185 0.905619738 13288 111 0.83534016
## 67 23 20428 42 0.205600157 13288 16 0.12040939
## 68 54 20428 5 0.024476209 13288 3 0.02257676
## 69 56 0 0 0.000000000 0 0 0.00000000
## 70 28 20428 120 0.587429019 13288 80 0.60204696
## 71 22 20428 35 0.171333464 13288 8 0.06020470
## 72 51 20428 29 0.141962013 13288 14 0.10535822
## 73 44 20428 49 0.239866849 13288 24 0.18061409
## percbar.filt ntot.A nbar.tot.A percbar.tot.A ntot.filt.A nbar.filt.A
## 1 0.00000 20428 1 0.004895242 9924 1
## 2 60.46512 20428 43 0.210495398 9924 18
## 3 100.00000 20428 2 0.009790484 9924 1
## 4 0.00000 20428 4 0.019580967 9924 1
## 5 25.00000 20428 8 0.039161935 9924 6
## 6 75.24752 20428 202 0.988838849 9924 115
## 7 55.55556 20428 153 0.748971999 9924 59
## 8 69.14968 20428 1423 6.965929117 9924 685
## 9 62.38095 20428 210 1.028000783 9924 70
## 10 52.38095 20428 21 0.102800078 9924 5
## 11 58.42391 20428 368 1.801448992 9924 170
## 12 67.77778 20428 360 1.762287057 9924 178
## 13 56.14035 20428 114 0.558057568 9924 63
## 14 54.65839 20428 161 0.788133934 9924 76
## 15 64.40678 20428 59 0.288819268 9924 27
## 16 43.28358 20428 67 0.327981202 9924 31
## 17 62.70567 20428 547 2.677697278 9924 260
## 18 53.39806 20428 206 1.008419816 9924 96
## 19 62.45211 20428 261 1.277658116 9924 113
## 20 61.06115 20428 1112 5.443508909 9924 589
## 21 56.96721 20428 488 2.388878011 9924 245
## 22 69.39655 20428 232 1.135696103 9924 131
## 23 62.71757 20428 1781 8.718425690 9924 716
## 24 53.12500 20428 32 0.156647738 9924 18
## 25 39.02439 20428 41 0.200704915 9924 19
## 26 66.55172 20428 290 1.419620129 9924 151
## 27 73.77201 20428 1079 5.281965929 9924 565
## 28 60.30043 20428 466 2.281182690 9924 228
## 29 57.66423 20428 137 0.670648130 9924 47
## 30 0.00000 0 0 0.000000000 0 0
## 31 80.46689 20428 2099 10.275112591 9924 1250
## 32 35.00000 20428 20 0.097904836 9924 7
## 33 62.31884 20428 138 0.675543372 9924 44
## 34 35.71429 20428 14 0.068533386 9924 3
## 35 58.06452 20428 93 0.455257490 9924 25
## 36 64.28571 20428 14 0.068533386 9924 8
## 37 56.47059 20428 170 0.832191110 9924 72
## 38 65.77181 20428 894 4.376346192 9924 413
## 39 46.66667 20428 15 0.073428627 9924 11
## 40 67.66576 20428 1101 5.389661249 9924 552
## 41 61.25000 20428 80 0.391619346 9924 45
## 42 59.80392 20428 102 0.499314666 9924 50
## 43 37.14286 20428 35 0.171333464 9924 16
## 44 40.00000 20428 10 0.048952418 9924 5
## 45 50.00000 20428 16 0.078323869 9924 6
## 46 40.00000 20428 10 0.048952418 9924 4
## 47 59.25926 20428 81 0.396514588 9924 36
## 48 62.65597 20428 1122 5.492461328 9924 561
## 49 66.48649 20428 185 0.905619738 9924 108
## 50 63.15789 20428 228 1.116115136 9924 104
## 51 50.00000 20428 30 0.146857255 9924 14
## 52 66.66667 20428 33 0.161542980 9924 23
## 53 39.13043 20428 23 0.112590562 9924 10
## 54 45.36082 20428 97 0.474838457 9924 43
## 55 56.52174 20428 23 0.112590562 9924 10
## 56 33.33333 20428 54 0.264343059 9924 24
## 57 50.81967 20428 122 0.597219503 9924 51
## 58 45.83333 20428 72 0.352457411 9924 28
## 59 67.96797 20428 999 4.890346583 9924 484
## 60 55.17241 20428 29 0.141962013 9924 19
## 61 74.51524 20428 361 1.767182299 9924 180
## 62 57.40741 20428 54 0.264343059 9924 27
## 63 50.00000 20428 104 0.509105150 9924 41
## 64 61.58680 20428 1273 6.231642843 9924 600
## 65 60.40609 20428 394 1.928725279 9924 164
## 66 60.00000 20428 185 0.905619738 9924 92
## 67 38.09524 20428 42 0.205600157 9924 15
## 68 60.00000 20428 5 0.024476209 9924 3
## 69 0.00000 0 0 0.000000000 0 0
## 70 66.66667 20428 120 0.587429019 9924 46
## 71 22.85714 20428 35 0.171333464 9924 19
## 72 48.27586 20428 29 0.141962013 9924 10
## 73 48.97959 20428 49 0.239866849 9924 17
## percbartot.filt.A percbar.filt.A
## 1 0.01007658 100.00000
## 2 0.18137848 41.86047
## 3 0.01007658 50.00000
## 4 0.01007658 25.00000
## 5 0.06045949 75.00000
## 6 1.15880693 56.93069
## 7 0.59451834 38.56209
## 8 6.90245869 48.13774
## 9 0.70536074 33.33333
## 10 0.05038291 23.80952
## 11 1.71301894 46.19565
## 12 1.79363160 49.44444
## 13 0.63482467 55.26316
## 14 0.76582023 47.20497
## 15 0.27206771 45.76271
## 16 0.31237404 46.26866
## 17 2.61991133 47.53199
## 18 0.96735187 46.60194
## 19 1.13865377 43.29502
## 20 5.93510681 52.96763
## 21 2.46876260 50.20492
## 22 1.32003225 56.46552
## 23 7.21483273 40.20213
## 24 0.18137848 56.25000
## 25 0.19145506 46.34146
## 26 1.52156389 52.06897
## 27 5.69326884 52.36330
## 28 2.29746070 48.92704
## 29 0.47359936 34.30657
## 30 0.00000000 0.00000
## 31 12.59572753 59.55217
## 32 0.07053607 35.00000
## 33 0.44336961 31.88406
## 34 0.03022975 21.42857
## 35 0.25191455 26.88172
## 36 0.08061266 57.14286
## 37 0.72551391 42.35294
## 38 4.16162838 46.19687
## 39 0.11084240 73.33333
## 40 5.56227328 50.13624
## 41 0.45344619 56.25000
## 42 0.50382910 49.01961
## 43 0.16122531 45.71429
## 44 0.05038291 50.00000
## 45 0.06045949 37.50000
## 46 0.04030633 40.00000
## 47 0.36275695 44.44444
## 48 5.65296252 50.00000
## 49 1.08827086 58.37838
## 50 1.04796453 45.61404
## 51 0.14107215 46.66667
## 52 0.23176139 69.69697
## 53 0.10076582 43.47826
## 54 0.43329303 44.32990
## 55 0.10076582 43.47826
## 56 0.24183797 44.44444
## 57 0.51390568 41.80328
## 58 0.28214430 38.88889
## 59 4.87706570 48.44845
## 60 0.19145506 65.51724
## 61 1.81378476 49.86150
## 62 0.27206771 50.00000
## 63 0.41313986 39.42308
## 64 6.04594921 47.13276
## 65 1.65255945 41.62437
## 66 0.92704555 49.72973
## 67 0.15114873 35.71429
## 68 0.03022975 60.00000
## 69 0.00000000 0.00000
## 70 0.46352277 38.33333
## 71 0.19145506 54.28571
## 72 0.10076582 34.48276
## 73 0.17130189 34.69388