library(FNN)

df <- read.csv(file='Seattle.csv')

## Split in train + test set
indexes <- sample(1:nrow(df),as.integer(0.7*nrow(df)))

trainData <- df[indexes,3:17]
testData <- df[-indexes,3:17]

## A 3-nearest neighbors model 
model <- knn.reg(train = trainData, test = testData, y = trainData$price, k=3)
prediction <- model$pred

actual <- testData$price
print(cbind(actual, prediction))