source("funcs.R")

df$ater <-as.numeric(str_split(df$Alapterület, " ",n=2,simplify = T)[,1])
df$eter <-as.numeric(str_split(df$Erkélymérete, " ",n=2,simplify = T)[,1])
df$eter[is.na(df$eter)]<- 0
df$ar <- sapply(df$Árhavonta, arconv)
df$ker <-	as.factor(as.numeric(as.roman(str_remove(str_split(df$cim, " ", simplify = T)[,1],"\\."))))

# ez hosszú !!
df$point <- sapply(df$cim, get_coords)
df <- df[!is.na(df$point),]
df$lat <- as.double(unlist(map(df$point,1)))
df$lon <- as.double(unlist(map(df[!is.na(df$point),]$point,2)))

df$szoba <- ifelse(grepl("fél",df$Szobák),as.numeric(unlist(map(str_split(df$Szobák," "),1))),as.numeric(df$Szobák))
df$felszoba <- ifelse(grepl("fél",df$Szobák),as.numeric(unlist(map(str_split(df$Szobák," "),3))),0)
# unlist(map(str_split(df$Szobák," "),3))
# df[felszoba==3,]$Szobák
# summary(grepl("fél",df$Szobák))

write.csv(df3,file = "adat_pozicioval.csv")
