str(data_csv)
## 'data.frame': 545 obs. of 13 variables:
## $ price : int 13300000 12250000 12250000 12215000 11410000 10850000 10150000 10150000 9870000 9800000 ...
## $ area : int 7420 8960 9960 7500 7420 7500 8580 16200 8100 5750 ...
## $ bedrooms : int 4 4 3 4 4 3 4 5 4 3 ...
## $ bathrooms : int 2 4 2 2 1 3 3 3 1 2 ...
## $ stories : int 3 4 2 2 2 1 4 2 2 4 ...
## $ mainroad : chr "yes" "yes" "yes" "yes" ...
## $ guestroom : chr "no" "no" "no" "no" ...
## $ basement : chr "no" "no" "yes" "yes" ...
## $ hotwaterheating : chr "no" "no" "no" "no" ...
## $ airconditioning : chr "yes" "yes" "no" "yes" ...
## $ parking : int 2 3 2 3 2 2 2 0 2 1 ...
## $ prefarea : chr "yes" "no" "yes" "yes" ...
## $ furnishingstatus: chr "furnished" "furnished" "semi-furnished" "furnished" ...
numerik_data <- data_csv[sapply(data_csv, is.numeric)]
(numerik_data)
## price area bedrooms bathrooms stories parking
## 1 13300000 7420 4 2 3 2
## 2 12250000 8960 4 4 4 3
## 3 12250000 9960 3 2 2 2
## 4 12215000 7500 4 2 2 3
## 5 11410000 7420 4 1 2 2
## 6 10850000 7500 3 3 1 2
## 7 10150000 8580 4 3 4 2
## 8 10150000 16200 5 3 2 0
## 9 9870000 8100 4 1 2 2
## 10 9800000 5750 3 2 4 1
## 11 9800000 13200 3 1 2 2
## 12 9681000 6000 4 3 2 2
## 13 9310000 6550 4 2 2 1
## 14 9240000 3500 4 2 2 2
## 15 9240000 7800 3 2 2 0
## 16 9100000 6000 4 1 2 2
## 17 9100000 6600 4 2 2 1
## 18 8960000 8500 3 2 4 2
## 19 8890000 4600 3 2 2 2
## 20 8855000 6420 3 2 2 1
## 21 8750000 4320 3 1 2 2
## 22 8680000 7155 3 2 1 2
## 23 8645000 8050 3 1 1 1
## 24 8645000 4560 3 2 2 1
## 25 8575000 8800 3 2 2 2
## 26 8540000 6540 4 2 2 2
## 27 8463000 6000 3 2 4 0
## 28 8400000 8875 3 1 1 1
## 29 8400000 7950 5 2 2 2
## 30 8400000 5500 4 2 2 1
## 31 8400000 7475 3 2 4 2
## 32 8400000 7000 3 1 4 2
## 33 8295000 4880 4 2 2 1
## 34 8190000 5960 3 3 2 1
## 35 8120000 6840 5 1 2 1
## 36 8080940 7000 3 2 4 2
## 37 8043000 7482 3 2 3 1
## 38 7980000 9000 4 2 4 2
## 39 7962500 6000 3 1 4 2
## 40 7910000 6000 4 2 4 1
## 41 7875000 6550 3 1 2 0
## 42 7840000 6360 3 2 4 0
## 43 7700000 6480 3 2 4 2
## 44 7700000 6000 4 2 4 2
## 45 7560000 6000 4 2 4 1
## 46 7560000 6000 3 2 3 0
## 47 7525000 6000 3 2 4 1
## 48 7490000 6600 3 1 4 3
## 49 7455000 4300 3 2 2 1
## 50 7420000 7440 3 2 1 0
## 51 7420000 7440 3 2 4 1
## 52 7420000 6325 3 1 4 1
## 53 7350000 6000 4 2 4 1
## 54 7350000 5150 3 2 4 2
## 55 7350000 6000 3 2 2 1
## 56 7350000 6000 3 1 2 1
## 57 7343000 11440 4 1 2 1
## 58 7245000 9000 4 2 4 1
## 59 7210000 7680 4 2 4 1
## 60 7210000 6000 3 2 4 1
## 61 7140000 6000 3 2 2 1
## 62 7070000 8880 2 1 1 1
## 63 7070000 6240 4 2 2 1
## 64 7035000 6360 4 2 3 2
## 65 7000000 11175 3 1 1 1
## 66 6930000 8880 3 2 2 1
## 67 6930000 13200 2 1 1 1
## 68 6895000 7700 3 2 1 2
## 69 6860000 6000 3 1 1 1
## 70 6790000 12090 4 2 2 2
## 71 6790000 4000 3 2 2 0
## 72 6755000 6000 4 2 4 0
## 73 6720000 5020 3 1 4 0
## 74 6685000 6600 2 2 4 0
## 75 6650000 4040 3 1 2 1
## 76 6650000 4260 4 2 2 0
## 77 6650000 6420 3 2 3 0
## 78 6650000 6500 3 2 3 0
## 79 6650000 5700 3 1 1 2
## 80 6650000 6000 3 2 3 0
## 81 6629000 6000 3 1 2 1
## 82 6615000 4000 3 2 2 1
## 83 6615000 10500 3 2 1 1
## 84 6580000 6000 3 2 4 0
## 85 6510000 3760 3 1 2 2
## 86 6510000 8250 3 2 3 0
## 87 6510000 6670 3 1 3 0
## 88 6475000 3960 3 1 1 2
## 89 6475000 7410 3 1 1 2
## 90 6440000 8580 5 3 2 2
## 91 6440000 5000 3 1 2 0
## 92 6419000 6750 2 1 1 2
## 93 6405000 4800 3 2 4 0
## 94 6300000 7200 3 2 1 3
## 95 6300000 6000 4 2 4 1
## 96 6300000 4100 3 2 3 2
## 97 6300000 9000 3 1 1 1
## 98 6300000 6400 3 1 1 1
## 99 6293000 6600 3 2 3 0
## 100 6265000 6000 4 1 3 0
## 101 6230000 6600 3 2 1 0
## 102 6230000 5500 3 1 3 1
## 103 6195000 5500 3 2 4 1
## 104 6195000 6350 3 2 3 0
## 105 6195000 5500 3 2 1 2
## 106 6160000 4500 3 1 4 0
## 107 6160000 5450 4 2 1 0
## 108 6125000 6420 3 1 3 0
## 109 6107500 3240 4 1 3 1
## 110 6090000 6615 4 2 2 1
## 111 6090000 6600 3 1 1 2
## 112 6090000 8372 3 1 3 2
## 113 6083000 4300 6 2 2 0
## 114 6083000 9620 3 1 1 2
## 115 6020000 6800 2 1 1 2
## 116 6020000 8000 3 1 1 2
## 117 6020000 6900 3 2 1 0
## 118 5950000 3700 4 1 2 0
## 119 5950000 6420 3 1 1 0
## 120 5950000 7020 3 1 1 2
## 121 5950000 6540 3 1 1 2
## 122 5950000 7231 3 1 2 0
## 123 5950000 6254 4 2 1 1
## 124 5950000 7320 4 2 2 0
## 125 5950000 6525 3 2 4 1
## 126 5943000 15600 3 1 1 2
## 127 5880000 7160 3 1 1 2
## 128 5880000 6500 3 2 3 0
## 129 5873000 5500 3 1 3 1
## 130 5873000 11460 3 1 3 2
## 131 5866000 4800 3 1 1 0
## 132 5810000 5828 4 1 4 0
## 133 5810000 5200 3 1 3 0
## 134 5810000 4800 3 1 3 0
## 135 5803000 7000 3 1 1 2
## 136 5775000 6000 3 2 4 0
## 137 5740000 5400 4 2 2 2
## 138 5740000 4640 4 1 2 1
## 139 5740000 5000 3 1 3 0
## 140 5740000 6360 3 1 1 2
## 141 5740000 5800 3 2 4 0
## 142 5652500 6660 4 2 2 1
## 143 5600000 10500 4 2 2 1
## 144 5600000 4800 5 2 3 0
## 145 5600000 4700 4 1 2 1
## 146 5600000 5000 3 1 4 0
## 147 5600000 10500 2 1 1 1
## 148 5600000 5500 3 2 2 1
## 149 5600000 6360 3 1 3 0
## 150 5600000 6600 4 2 1 0
## 151 5600000 5136 3 1 2 0
## 152 5565000 4400 4 1 2 2
## 153 5565000 5400 5 1 2 0
## 154 5530000 3300 3 3 2 0
## 155 5530000 3650 3 2 2 2
## 156 5530000 6100 3 2 1 2
## 157 5523000 6900 3 1 1 0
## 158 5495000 2817 4 2 2 1
## 159 5495000 7980 3 1 1 2
## 160 5460000 3150 3 2 1 0
## 161 5460000 6210 4 1 4 0
## 162 5460000 6100 3 1 3 0
## 163 5460000 6600 4 2 2 0
## 164 5425000 6825 3 1 1 0
## 165 5390000 6710 3 2 2 1
## 166 5383000 6450 3 2 1 0
## 167 5320000 7800 3 1 1 2
## 168 5285000 4600 2 2 1 2
## 169 5250000 4260 4 1 2 0
## 170 5250000 6540 4 2 2 0
## 171 5250000 5500 3 2 1 0
## 172 5250000 10269 3 1 1 1
## 173 5250000 8400 3 1 2 2
## 174 5250000 5300 4 2 1 0
## 175 5250000 3800 3 1 2 1
## 176 5250000 9800 4 2 2 2
## 177 5250000 8520 3 1 1 2
## 178 5243000 6050 3 1 1 0
## 179 5229000 7085 3 1 1 2
## 180 5215000 3180 3 2 2 2
## 181 5215000 4500 4 2 1 2
## 182 5215000 7200 3 1 2 1
## 183 5145000 3410 3 1 2 0
## 184 5145000 7980 3 1 1 1
## 185 5110000 3000 3 2 2 0
## 186 5110000 3000 3 1 2 0
## 187 5110000 11410 2 1 2 0
## 188 5110000 6100 3 1 1 0
## 189 5075000 5720 2 1 2 0
## 190 5040000 3540 2 1 1 0
## 191 5040000 7600 4 1 2 2
## 192 5040000 10700 3 1 2 0
## 193 5040000 6600 3 1 1 0
## 194 5033000 4800 2 1 1 0
## 195 5005000 8150 3 2 1 0
## 196 4970000 4410 4 3 2 2
## 197 4970000 7686 3 1 1 0
## 198 4956000 2800 3 2 2 1
## 199 4935000 5948 3 1 2 0
## 200 4907000 4200 3 1 2 1
## 201 4900000 4520 3 1 2 0
## 202 4900000 4095 3 1 2 0
## 203 4900000 4120 2 1 1 1
## 204 4900000 5400 4 1 2 0
## 205 4900000 4770 3 1 1 0
## 206 4900000 6300 3 1 1 2
## 207 4900000 5800 2 1 1 0
## 208 4900000 3000 3 1 2 0
## 209 4900000 2970 3 1 3 0
## 210 4900000 6720 3 1 1 0
## 211 4900000 4646 3 1 2 2
## 212 4900000 12900 3 1 1 2
## 213 4893000 3420 4 2 2 2
## 214 4893000 4995 4 2 1 0
## 215 4865000 4350 2 1 1 0
## 216 4830000 4160 3 1 3 0
## 217 4830000 6040 3 1 1 2
## 218 4830000 6862 3 1 2 2
## 219 4830000 4815 2 1 1 0
## 220 4795000 7000 3 1 2 0
## 221 4795000 8100 4 1 4 2
## 222 4767000 3420 4 2 2 0
## 223 4760000 9166 2 1 1 2
## 224 4760000 6321 3 1 2 1
## 225 4760000 10240 2 1 1 2
## 226 4753000 6440 2 1 1 3
## 227 4690000 5170 3 1 4 0
## 228 4690000 6000 2 1 1 1
## 229 4690000 3630 3 1 2 2
## 230 4690000 9667 4 2 2 1
## 231 4690000 5400 2 1 2 0
## 232 4690000 4320 3 1 1 0
## 233 4655000 3745 3 1 2 0
## 234 4620000 4160 3 1 1 0
## 235 4620000 3880 3 2 2 2
## 236 4620000 5680 3 1 2 1
## 237 4620000 2870 2 1 2 0
## 238 4620000 5010 3 1 2 0
## 239 4613000 4510 4 2 2 0
## 240 4585000 4000 3 1 2 1
## 241 4585000 3840 3 1 2 1
## 242 4550000 3760 3 1 1 2
## 243 4550000 3640 3 1 2 0
## 244 4550000 2550 3 1 2 0
## 245 4550000 5320 3 1 2 0
## 246 4550000 5360 3 1 2 2
## 247 4550000 3520 3 1 1 0
## 248 4550000 8400 4 1 4 3
## 249 4543000 4100 2 2 1 0
## 250 4543000 4990 4 2 2 0
## 251 4515000 3510 3 1 3 0
## 252 4515000 3450 3 1 2 1
## 253 4515000 9860 3 1 1 0
## 254 4515000 3520 2 1 2 0
## 255 4480000 4510 4 1 2 2
## 256 4480000 5885 2 1 1 1
## 257 4480000 4000 3 1 2 2
## 258 4480000 8250 3 1 1 0
## 259 4480000 4040 3 1 2 1
## 260 4473000 6360 2 1 1 1
## 261 4473000 3162 3 1 2 1
## 262 4473000 3510 3 1 2 0
## 263 4445000 3750 2 1 1 0
## 264 4410000 3968 3 1 2 0
## 265 4410000 4900 2 1 2 0
## 266 4403000 2880 3 1 2 0
## 267 4403000 4880 3 1 1 2
## 268 4403000 4920 3 1 2 1
## 269 4382000 4950 4 1 2 0
## 270 4375000 3900 3 1 2 0
## 271 4340000 4500 3 2 3 1
## 272 4340000 1905 5 1 2 0
## 273 4340000 4075 3 1 1 2
## 274 4340000 3500 4 1 2 2
## 275 4340000 6450 4 1 2 0
## 276 4319000 4032 2 1 1 0
## 277 4305000 4400 2 1 1 1
## 278 4305000 10360 2 1 1 1
## 279 4277000 3400 3 1 2 2
## 280 4270000 6360 2 1 1 0
## 281 4270000 6360 2 1 2 0
## 282 4270000 4500 2 1 1 2
## 283 4270000 2175 3 1 2 0
## 284 4270000 4360 4 1 2 0
## 285 4270000 7770 2 1 1 1
## 286 4235000 6650 3 1 2 0
## 287 4235000 2787 3 1 1 0
## 288 4200000 5500 3 1 2 0
## 289 4200000 5040 3 1 2 0
## 290 4200000 5850 2 1 1 2
## 291 4200000 2610 4 3 2 0
## 292 4200000 2953 3 1 2 0
## 293 4200000 2747 4 2 2 0
## 294 4200000 4410 2 1 1 1
## 295 4200000 4000 4 2 2 0
## 296 4200000 2325 3 1 2 0
## 297 4200000 4600 3 2 2 1
## 298 4200000 3640 3 2 2 0
## 299 4200000 5800 3 1 1 2
## 300 4200000 7000 3 1 1 3
## 301 4200000 4079 3 1 3 0
## 302 4200000 3520 3 1 2 0
## 303 4200000 2145 3 1 3 1
## 304 4200000 4500 3 1 1 0
## 305 4193000 8250 3 1 1 3
## 306 4193000 3450 3 1 2 1
## 307 4165000 4840 3 1 2 1
## 308 4165000 4080 3 1 2 2
## 309 4165000 4046 3 1 2 1
## 310 4130000 4632 4 1 2 0
## 311 4130000 5985 3 1 1 0
## 312 4123000 6060 2 1 1 1
## 313 4098500 3600 3 1 1 0
## 314 4095000 3680 3 2 2 0
## 315 4095000 4040 2 1 2 1
## 316 4095000 5600 2 1 1 0
## 317 4060000 5900 4 2 2 1
## 318 4060000 4992 3 2 2 2
## 319 4060000 4340 3 1 1 0
## 320 4060000 3000 4 1 3 2
## 321 4060000 4320 3 1 2 2
## 322 4025000 3630 3 2 2 2
## 323 4025000 3460 3 2 1 1
## 324 4025000 5400 3 1 1 3
## 325 4007500 4500 3 1 2 0
## 326 4007500 3460 4 1 2 0
## 327 3990000 4100 4 1 1 0
## 328 3990000 6480 3 1 2 1
## 329 3990000 4500 3 2 2 0
## 330 3990000 3960 3 1 2 0
## 331 3990000 4050 2 1 2 0
## 332 3920000 7260 3 2 1 3
## 333 3920000 5500 4 1 2 0
## 334 3920000 3000 3 1 2 0
## 335 3920000 3290 2 1 1 1
## 336 3920000 3816 2 1 1 2
## 337 3920000 8080 3 1 1 2
## 338 3920000 2145 4 2 1 0
## 339 3885000 3780 2 1 2 0
## 340 3885000 3180 4 2 2 0
## 341 3850000 5300 5 2 2 0
## 342 3850000 3180 2 2 1 2
## 343 3850000 7152 3 1 2 0
## 344 3850000 4080 2 1 1 0
## 345 3850000 3850 2 1 1 0
## 346 3850000 2015 3 1 2 0
## 347 3850000 2176 2 1 2 0
## 348 3836000 3350 3 1 2 0
## 349 3815000 3150 2 2 1 0
## 350 3780000 4820 3 1 2 0
## 351 3780000 3420 2 1 2 1
## 352 3780000 3600 2 1 1 0
## 353 3780000 5830 2 1 1 2
## 354 3780000 2856 3 1 3 0
## 355 3780000 8400 2 1 1 1
## 356 3773000 8250 3 1 1 2
## 357 3773000 2520 5 2 1 1
## 358 3773000 6930 4 1 2 1
## 359 3745000 3480 2 1 1 0
## 360 3710000 3600 3 1 1 1
## 361 3710000 4040 2 1 1 0
## 362 3710000 6020 3 1 1 0
## 363 3710000 4050 2 1 1 0
## 364 3710000 3584 2 1 1 0
## 365 3703000 3120 3 1 2 0
## 366 3703000 5450 2 1 1 0
## 367 3675000 3630 2 1 1 0
## 368 3675000 3630 2 1 1 0
## 369 3675000 5640 2 1 1 0
## 370 3675000 3600 2 1 1 0
## 371 3640000 4280 2 1 1 2
## 372 3640000 3570 3 1 2 0
## 373 3640000 3180 3 1 2 0
## 374 3640000 3000 2 1 2 0
## 375 3640000 3520 2 2 1 0
## 376 3640000 5960 3 1 2 0
## 377 3640000 4130 3 2 2 2
## 378 3640000 2850 3 2 2 0
## 379 3640000 2275 3 1 3 0
## 380 3633000 3520 3 1 1 2
## 381 3605000 4500 2 1 1 0
## 382 3605000 4000 2 1 1 0
## 383 3570000 3150 3 1 2 0
## 384 3570000 4500 4 2 2 2
## 385 3570000 4500 2 1 1 0
## 386 3570000 3640 2 1 1 0
## 387 3535000 3850 3 1 1 2
## 388 3500000 4240 3 1 2 0
## 389 3500000 3650 3 1 2 0
## 390 3500000 4600 4 1 2 0
## 391 3500000 2135 3 2 2 0
## 392 3500000 3036 3 1 2 0
## 393 3500000 3990 3 1 2 0
## 394 3500000 7424 3 1 1 0
## 395 3500000 3480 3 1 1 0
## 396 3500000 3600 6 1 2 1
## 397 3500000 3640 2 1 1 1
## 398 3500000 5900 2 1 1 1
## 399 3500000 3120 3 1 2 1
## 400 3500000 7350 2 1 1 1
## 401 3500000 3512 2 1 1 1
## 402 3500000 9500 3 1 2 3
## 403 3500000 5880 2 1 1 0
## 404 3500000 12944 3 1 1 0
## 405 3493000 4900 3 1 2 0
## 406 3465000 3060 3 1 1 0
## 407 3465000 5320 2 1 1 1
## 408 3465000 2145 3 1 3 0
## 409 3430000 4000 2 1 1 0
## 410 3430000 3185 2 1 1 2
## 411 3430000 3850 3 1 1 0
## 412 3430000 2145 3 1 3 0
## 413 3430000 2610 3 1 2 0
## 414 3430000 1950 3 2 2 0
## 415 3423000 4040 2 1 1 0
## 416 3395000 4785 3 1 2 1
## 417 3395000 3450 3 1 1 2
## 418 3395000 3640 2 1 1 0
## 419 3360000 3500 4 1 2 2
## 420 3360000 4960 4 1 3 0
## 421 3360000 4120 2 1 2 0
## 422 3360000 4750 2 1 1 0
## 423 3360000 3720 2 1 1 0
## 424 3360000 3750 3 1 1 0
## 425 3360000 3100 3 1 2 0
## 426 3360000 3185 2 1 1 2
## 427 3353000 2700 3 1 1 0
## 428 3332000 2145 3 1 2 0
## 429 3325000 4040 2 1 1 1
## 430 3325000 4775 4 1 2 0
## 431 3290000 2500 2 1 1 0
## 432 3290000 3180 4 1 2 0
## 433 3290000 6060 3 1 1 0
## 434 3290000 3480 4 1 2 1
## 435 3290000 3792 4 1 2 0
## 436 3290000 4040 2 1 1 0
## 437 3290000 2145 3 1 2 0
## 438 3290000 5880 3 1 1 1
## 439 3255000 4500 2 1 1 0
## 440 3255000 3930 2 1 1 0
## 441 3234000 3640 4 1 2 0
## 442 3220000 4370 3 1 2 0
## 443 3220000 2684 2 1 1 1
## 444 3220000 4320 3 1 1 1
## 445 3220000 3120 3 1 2 0
## 446 3150000 3450 1 1 1 0
## 447 3150000 3986 2 2 1 1
## 448 3150000 3500 2 1 1 0
## 449 3150000 4095 2 1 1 2
## 450 3150000 1650 3 1 2 0
## 451 3150000 3450 3 1 2 0
## 452 3150000 6750 2 1 1 0
## 453 3150000 9000 3 1 2 2
## 454 3150000 3069 2 1 1 1
## 455 3143000 4500 3 1 2 0
## 456 3129000 5495 3 1 1 0
## 457 3118850 2398 3 1 1 0
## 458 3115000 3000 3 1 1 0
## 459 3115000 3850 3 1 2 0
## 460 3115000 3500 2 1 1 0
## 461 3087000 8100 2 1 1 1
## 462 3080000 4960 2 1 1 0
## 463 3080000 2160 3 1 2 0
## 464 3080000 3090 2 1 1 0
## 465 3080000 4500 2 1 2 1
## 466 3045000 3800 2 1 1 0
## 467 3010000 3090 3 1 2 0
## 468 3010000 3240 3 1 2 2
## 469 3010000 2835 2 1 1 0
## 470 3010000 4600 2 1 1 0
## 471 3010000 5076 3 1 1 0
## 472 3010000 3750 3 1 2 0
## 473 3010000 3630 4 1 2 3
## 474 3003000 8050 2 1 1 0
## 475 2975000 4352 4 1 2 1
## 476 2961000 3000 2 1 2 0
## 477 2940000 5850 3 1 2 1
## 478 2940000 4960 2 1 1 0
## 479 2940000 3600 3 1 2 1
## 480 2940000 3660 4 1 2 0
## 481 2940000 3480 3 1 2 1
## 482 2940000 2700 2 1 1 0
## 483 2940000 3150 3 1 2 0
## 484 2940000 6615 3 1 2 0
## 485 2870000 3040 2 1 1 0
## 486 2870000 3630 2 1 1 0
## 487 2870000 6000 2 1 1 0
## 488 2870000 5400 4 1 2 0
## 489 2852500 5200 4 1 3 0
## 490 2835000 3300 3 1 2 1
## 491 2835000 4350 3 1 2 1
## 492 2835000 2640 2 1 1 1
## 493 2800000 2650 3 1 2 1
## 494 2800000 3960 3 1 1 0
## 495 2730000 6800 2 1 1 0
## 496 2730000 4000 3 1 2 1
## 497 2695000 4000 2 1 1 0
## 498 2660000 3934 2 1 1 0
## 499 2660000 2000 2 1 2 0
## 500 2660000 3630 3 3 2 0
## 501 2660000 2800 3 1 1 0
## 502 2660000 2430 3 1 1 0
## 503 2660000 3480 2 1 1 1
## 504 2660000 4000 3 1 1 0
## 505 2653000 3185 2 1 1 0
## 506 2653000 4000 3 1 2 0
## 507 2604000 2910 2 1 1 0
## 508 2590000 3600 2 1 1 0
## 509 2590000 4400 2 1 1 0
## 510 2590000 3600 2 2 2 1
## 511 2520000 2880 3 1 1 0
## 512 2520000 3180 3 1 1 0
## 513 2520000 3000 2 1 2 0
## 514 2485000 4400 3 1 2 0
## 515 2485000 3000 3 1 2 0
## 516 2450000 3210 3 1 2 0
## 517 2450000 3240 2 1 1 1
## 518 2450000 3000 2 1 1 1
## 519 2450000 3500 2 1 1 0
## 520 2450000 4840 2 1 2 0
## 521 2450000 7700 2 1 1 0
## 522 2408000 3635 2 1 1 0
## 523 2380000 2475 3 1 2 0
## 524 2380000 2787 4 2 2 0
## 525 2380000 3264 2 1 1 0
## 526 2345000 3640 2 1 1 0
## 527 2310000 3180 2 1 1 0
## 528 2275000 1836 2 1 1 0
## 529 2275000 3970 1 1 1 0
## 530 2275000 3970 3 1 2 0
## 531 2240000 1950 3 1 1 0
## 532 2233000 5300 3 1 1 0
## 533 2135000 3000 2 1 1 0
## 534 2100000 2400 3 1 2 0
## 535 2100000 3000 4 1 2 0
## 536 2100000 3360 2 1 1 1
## 537 1960000 3420 5 1 2 0
## 538 1890000 1700 3 1 2 0
## 539 1890000 3649 2 1 1 0
## 540 1855000 2990 2 1 1 1
## 541 1820000 3000 2 1 1 2
## 542 1767150 2400 3 1 1 0
## 543 1750000 3620 2 1 1 0
## 544 1750000 2910 3 1 1 0
## 545 1750000 3850 3 1 2 0
knitr::opts_chunk$set(echo = TRUE)
#install.packages("ggplot2")
#install.packages("gridExtra")
# Load library
library(ggplot2)
library(gridExtra)
# Menentukan variabel numerik
numerik_data <- c("price", "area", "bedrooms", "bathrooms", "stories", "parking")
# Membuat daftar plot
plot_list <- list()
for (col in numerik_data) {
p <- ggplot(data_csv, aes_string(x = col)) +
geom_histogram(fill = "green", color = "blue", bins = 30, alpha = 0.7) +
ggtitle(paste("Histogram of", col)) +
theme_minimal()
plot_list[[col]] <- p
}
## Warning: `aes_string()` was deprecated in ggplot2 3.0.0.
## ℹ Please use tidy evaluation idioms with `aes()`.
## ℹ See also `vignette("ggplot2-in-packages")` for more information.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
# Menampilkan semua plot dalam satu gambar
do.call(grid.arrange, c(plot_list, ncol = 2))
numerik_kolom <- c("price", "area", "bedrooms", "bathrooms", "stories", "parking")
# Memilih kolom numerik dari dataset
numerik_data <- data_csv[, numerik_kolom]
# Memastikan dalam bentuk data frame
numerik_data <- as.data.frame(numerik_data)
# Menghitung kovarian matriks
cov_matrix <- cov(numerik_data)
print(cov_matrix)
## price area bedrooms bathrooms stories
## price 3.498544e+12 2.175676e+09 5.059464e+05 4.864093e+05 6.826446e+05
## area 2.175676e+09 4.709512e+06 2.432321e+02 2.113466e+02 1.581294e+02
## bedrooms 5.059464e+05 2.432321e+02 5.447383e-01 1.386738e-01 2.615893e-01
## bathrooms 4.864093e+05 2.113466e+02 1.386738e-01 2.524757e-01 1.421715e-01
## stories 6.826446e+05 1.581294e+02 2.615893e-01 1.421715e-01 7.525432e-01
## parking 6.194673e+05 6.599897e+02 8.856247e-02 7.684161e-02 3.404277e-02
## parking
## price 6.194673e+05
## area 6.599897e+02
## bedrooms 8.856247e-02
## bathrooms 7.684161e-02
## stories 3.404277e-02
## parking 7.423300e-01
cor_matrix <- cor(numerik_data)
print(cor_matrix)
## price area bedrooms bathrooms stories parking
## price 1.0000000 0.53599735 0.3664940 0.5175453 0.42071237 0.38439365
## area 0.5359973 1.00000000 0.1518585 0.1938195 0.08399605 0.35298048
## bedrooms 0.3664940 0.15185849 1.0000000 0.3739302 0.40856424 0.13926990
## bathrooms 0.5175453 0.19381953 0.3739302 1.0000000 0.32616471 0.17749582
## stories 0.4207124 0.08399605 0.4085642 0.3261647 1.00000000 0.04554709
## parking 0.3843936 0.35298048 0.1392699 0.1774958 0.04554709 1.00000000
#install.packages("reshape2")
library(ggplot2)
library(reshape2)
cor_melted <- melt(cor_matrix)
ggplot(data = cor_melted, aes(x = Var1, y = Var2, fill = value)) +
geom_tile(color = "white") +
geom_text(aes(label = round(value, 2)), size = 4, fontface = "bold") +
scale_fill_gradientn(colors = c("white", "green", "blue", "red"),
values = scales::rescale(c(-1, 0, 0.5, 1)),
limits = c(-1, 1),
name = "Correlation") +
theme_minimal() +
xlab("") + ylab("") +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
ggtitle("Heatmap Korelasi Antar Variabel")
# Menghitung Eigen value dengan Rumus |A - λI| = 0
I <- diag(ncol(cov_matrix))
lambda_values <- eigen(cov_matrix)$values
print(lambda_values)
## [1] 3.498546e+12 3.356500e+06 7.345801e-01 5.958731e-01 3.626262e-01
## [6] 1.677009e-01
# Menghitung Eigen vector dengan (A - λI)v = 0
eigenvectors <- eigen(cov_matrix)$vectors
print(eigenvectors)
## [,1] [,2] [,3] [,4] [,5]
## [1,] 9.999998e-01 6.218809e-04 2.350022e-07 2.360030e-07 -1.896406e-08
## [2,] 6.218809e-04 -9.999998e-01 -1.068146e-04 4.693651e-05 1.227917e-05
## [3,] 1.446162e-07 2.127405e-05 -4.831235e-01 -3.524835e-01 -7.742078e-01
## [4,] 1.390319e-07 2.715391e-05 -1.156247e-01 -7.418855e-02 -1.559105e-01
## [5,] 1.951224e-07 7.936672e-05 -7.760615e-01 -2.230034e-01 5.897316e-01
## [6,] 1.770643e-07 -8.185750e-05 3.885243e-01 -9.058261e-01 1.688515e-01
## [,6]
## [1,] 1.167426e-07
## [2,] -2.065080e-05
## [3,] 2.072422e-01
## [4,] -9.781712e-01
## [5,] 1.465063e-02
## [6,] -4.137110e-03
# Mengambil Eigen Value terbesar
max_eigen_index <- which.max(lambda_values)
max_eigenvectors <- eigenvectors[, max_eigen_index]
print(lambda_values[max_eigen_index])
## [1] 3.498546e+12
# Eigen vector maximal
print(max_eigenvectors)
## [1] 9.999998e-01 6.218809e-04 1.446162e-07 1.390319e-07 1.951224e-07
## [6] 1.770643e-07
# Model regresi
model <- lm(price ~ area + bedrooms + bathrooms + stories + parking, data = numerik_data)
summary(model)
##
## Call:
## lm(formula = price ~ area + bedrooms + bathrooms + stories +
## parking, data = numerik_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3396744 -731825 -64056 601486 5651126
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -145734.5 246634.5 -0.591 0.5548
## area 331.1 26.6 12.448 < 2e-16 ***
## bedrooms 167809.8 82932.7 2.023 0.0435 *
## bathrooms 1133740.2 118828.3 9.541 < 2e-16 ***
## stories 547939.8 68894.5 7.953 1.07e-14 ***
## parking 377596.3 66804.1 5.652 2.57e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1244000 on 539 degrees of freedom
## Multiple R-squared: 0.5616, Adjusted R-squared: 0.5575
## F-statistic: 138.1 on 5 and 539 DF, p-value: < 2.2e-16
# Menghitung RMSE
predicted_prices <- predict(model, numerik_data)
actual_prices <- numerik_data$price
rmse <- sqrt(mean((predicted_prices - actual_prices)^2))
print(paste("RMSE:", rmse))
## [1] "RMSE: 1237339.30781674"
# Menampilkan prediksi harga rumah tertinggi
numerik_data$predicted_price <- predicted_prices
max_price_data <- numerik_data[which.max(numerik_data$predicted_price), ]
# Visualisasi
library(ggplot2)
ggplot(numerik_data, aes(x = area, y = predicted_price)) +
geom_point(color = "blue", alpha = 0.5) +
geom_point(data = max_price_data, aes(x = area, y = predicted_price), color = "yellow", size = 3) +
ggtitle("Prediksi Price Tertinggi") +
xlab("Luas Area") + ylab("Price Prediksi") + theme_minimal()
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.