I am using the ahp package for R (cran.r-project.org/web/packages/ahp). I built a new document .ahp with the alternatives and criteria
Version: 2.0
#########################
# Alternatives Section
#
Alternatives: &alternatives
# Here, we list all the alternatives, together with their attributes.
A:
hectareas: 1.88
ninos: 1
adultos: 12
B:
hectareas: 21.06
ninos: 14
adultos: 19
#
# End of Alternatives Section
#####################################
#####################################
# Goal Section
#
Goal:
# The goal spans a tree of criteria and the alternatives
name: Zona Verde
description: >
This is a classic single decision maker problem.
author: unknown
preferences:
# preferences are typically defined pairwise
# 1 means: A is equal to B
# 9 means: A is highly preferrable to B
# 1/9 means: B is highly preferrable to A
pairwise:
- [hectareas, ninos, 3]
- [hectareas, adultos, 7]
- [ninos, adultos, 3]
children:
hectareas:
preferences:
pairwise:
- [A, B, 9]
children: *alternatives
ninos:
preferences:
pairwise:
- [A, B, 1/3]
children: *alternatives
adultos:
preferences:
pairwise:
- [A, B, 1/4]
children: *alternatives
#
# End of Goal Section
#####################################
The other document is ahp.R by te libray and analysis
library(ahp)
#list example files provided by the package
list.files(system.file("extdata", package="ahp"))
#zonas verdes example
ahpFile <- system.file("extdata", "zonasverdes.ahp", package="ahp")
zonasverdesAhp <- Load(ahpFile)
Calculate(zonasverdesAhp)
Analyze(zonasverdesAhp)
AnalyzeTable(zonasverdesAhp)
When I run the code to analyze the AHP results appear this error:
Error in value[[3L]](cond) :
Could not load ahp model. Exception caught when converting into a data.tree: Error in preferences[[type]]: attempt to select less than one element in get1index
I do not know if there are mistakes in the code indented or in some functions.
Thanks
This is a question about indentation. In lines 49, 54, and 59 of ahpfile, you need to reduce indentation. like this: