-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpain_fuel_network.R
31 lines (25 loc) · 1.12 KB
/
Spain_fuel_network.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
#SPAIN FUEL NETWORK
#Reading the file
gasolineras <- read.table(file = "C:/Users/pavla/OneDrive/Documents/MASTER KSCHOOL/9. R/kschool_master_data_science_2017 (1)/data/carburantes_20050222.csv",
sep = "\t", header = T, quote = " ", dec = ",")
#Overview of the data and plotting the data
head(gasolineras, 6)
colnames(gasolineras)
str(gasolineras)
dim(gasolineras)
#Raname of the columns to "lat" and "lot"
colnames(gasolineras)[c(7,8)] <- c("lon","lat")
#Graphical visualization of the data
hist(gasolineras$lon)
plot(gasolineras$lon, gasolineras$lat, col = "dark grey", main = "Red de gasolineras en España",
xlab = "Longitud", ylab = "Latitud")
#Excluding Canary Islands from the Spanish network
gasolineras[,"lat"]
length(gasolineras$Provincia[gasolineras$lat < 30])
head(gasolineras[gasolineras$lat >30,],3)
gassinCan <- gasolineras[gasolineras$lat > 30,]
dim(gassinCan)
#Graphical visualization of the data excl. Canary Islands
hist(gassinCan$lon)
plot(gassinCan$lon, gassinCan$lat, col = "dark grey", main = "Red de gasolineras en España excl. Canarias",
xlab = "Longitud", ylab = "Latitud")