Ultimately, I want to use my yaml file in the ahp package. But first, I need to read my yaml file into R. I made my file in Notepad++ and everything is tab delineated.
I use the following code to try to read my file in R:
GIC <- yaml.load_file("/filepath/filename.yml")
after loading the yaml library
I keep getting this error message:
Error in yaml.load(paste(readLines(input, encoding = "UTF-8"), collapse = "\n"), : Scanner error: while scanning for the next token at line 4, column 1found character that cannot start any token at line 4, column 1 In addition: Warning message: In readLines(input, encoding = "UTF-8") : incomplete final line found on 'GIC assessment.yml'
When I make it space-delineated instead, I get this error message:
Warning message: In readLines(input, encoding = "UTF-8") :
incomplete final line found on 'GIC assessment 2.yml'
I have actually tried with a yaml file that I know specifically works in R (the data package from ahp) and it also gives me above error message.
I am at a complete loss, any ideas would be greatly appreciated.
My file is: Version: 1.0
Alternatives: &alternatives
GIC Monitoring:
Geologic Data:
USGS:
Energy Infrastructure:
Variometer:
Goal:
name: Data Source
preferences:
pairwise:
- [Coverage, Cost, 2]
- [Coverage, Reliability, 1/3]
- [Cost, Reliability, 1/5]
children:
Coverage:
preferences:
pairwise:
- [Temporal, Spatial, 1/5]
children:
Temporal:
preferences:
pairwise:
- [GIC Monitoring, Geologic Data, 8]
- [GIC Monitoring, USGS, 8]
- [GIC Monitoring, Energy Infrastructure, 8]
- [GIC Monitoring, Variometer, 9]
- [Geologic Data, USGS, 1]
- [Geologic Data, Energy Infrastructure, 1]
- [Geologic Data, Variometer, 7]
- [USGS, Energy Infrastructure, 1]
- [USGS, Variometer, 7]
- [Energy Infrastructure, Variometer, 7]
Spatial:
preferences:
pairwise:
- [GIC Monitoring, Geologic Data, 1]
- [GIC Monitoring, USGS, 1]
- [GIC Monitoring, Energy Infrastructure, 1/7]
- [GIC Monitoring, Variometer, 5]
- [Geologic Data, USGS, 1]
- [Geologic Data, Energy Infrastructure, 1/7]
- [Geologic Data, Variometer, 5]
- [USGS, Energy Infrastructure, 1/7]
- [USGS, Variometer, 5]
- [Energy Infrastructure, Variometer, 5]
children: *alternatives
Cost:
preferences:
pairwise:
- [GIC Monitoring, Geologic Data, 1]
- [GIC Monitoring, USGS, 1]
- [GIC Monitoring, Energy Infrastructure, 1]
- [GIC Monitoring, Variometer, 1/9]
- [Geologic Data, USGS, 1]
- [Geologic Data, Energy Infrastructure, 1]
- [Geologic Data, Variometer, 1/9]
- [USGS, Energy Infrastructure, 1]
- [USGS, Variometer, 1/9]
- [Energy Infrastructure, Variometer, 1/9]
children: *alternatives
Reliability:
preferences:
pairwise:
- [GIC Monitoring, Geologic Data, 1]
- [GIC Monitoring, USGS, 1]
- [GIC Monitoring, Energy Infrastructure, 1]
- [GIC Monitoring, Variometer, 9]
- [Geologic Data, USGS, 1]
- [Geologic Data, Energy Infrastructure, 1]
- [Geologic Data, Variometer, 9]
- [USGS, Energy Infrastructure, 1]
- [USGS, Variometer, 9]
- [Energy Infrastructure, Variometer, 9]
children: *alternatives