# NOT RUN {
library(FuzzyR)
library(tibble)
# Create spatial plateau objects for the linguistic variable accomodation_price
lvals_accom_price <- c("cut-rate", "affordable", "expensive")
cut_rate_mf <- genmf("trapmf", c(0, 0, 10, 48))
affordable_mf <- genmf("trapmf", c(10, 48, 80, 115))
expensive_mf <- genmf("trapmf", c(80, 115, 10000, 10000))
# Example of dataset
accom_price <- tibble(
`longitude` = c(-74.0, -74.0, -74.0),
`latitude` = c(40.8, 40.7, 40.7),
`price` = c(150, 76, 60)
)
accom_price_layer <- spa_creator(accom_price, classes = lvals_accom_price,
mfs = c(cut_rate_mf, affordable_mf, expensive_mf))
# Create the fsi_model:
fsi <- fsi_create("To visit or not to visit, that is the question",
default_conseq = genmf("trimf", c(10, 30, 60)))
# Add the fuzzy spatial antecedent to the fsi_model:
fsi <- fsi_add_fsa(fsi, "accommodation price", accom_price_layer)
# }
Run the code above in your browser using DataLab