if (FALSE) {
# load package 'fuzzySim' and its sample data:
require(fuzzySim)
data(rotif.env)
# add a column specifying the hemisphere:
unique(rotif.env$CONTINENT)
rotif.env$HEMISPHERE <- "Eastern"
rotif.env$HEMISPHERE[rotif.env$CONTINENT %in%
c("NORTHERN_AMERICA", "SOUTHERN_AMERICA")] <- "Western"
head(rotif.env)
# perform a MESS analysis
# suppose you'll extrapolate models from the Western hemisphere (Americas)
# to the Eastern hemisphere (rest of the world):
names(rotif.env) # variables are in columns 5:17
west <- subset(rotif.env, HEMISPHERE == "Western", select = 5:17)
east <- subset(rotif.env, HEMISPHERE == "Eastern", select = 5:17)
east.with.ID <- subset(rotif.env, HEMISPHERE == "Eastern",
select = c(1, 5:17))
head(east)
head(east.with.ID) # ID is in column 1
mess <- MESS(V = west, P = east)
mess.with.ID <- MESS(V = west, P = east.with.ID, id.col = 1)
head(mess)
head(mess.with.ID)
range(mess[ , "TOTAL"])
}
Run the code above in your browser using DataLab