我无法将我的yaml文件加载到R

时间:2016-12-01 17:53:41

标签: r yaml

最终,我想在ahp包中使用我的yaml文件。但首先,我需要将我的yaml文件读入R.我在Notepad ++中创建了我的文件,所有内容都是标签。

我使用以下代码尝试在R中读取我的文件:

GIC <- yaml.load_file("/filepath/filename.yml") 
加载yaml库后

我不断收到此错误消息:

  

yaml.load中的错误(粘贴(readLines(input,encoding =“UTF-8”),   collapse =“\ n”),:扫描程序错误:扫描下一个   第4行的令牌,第1列无法启动任何令牌的字符   在第4行,第1列另外:警告信息:在readLines(输入,   encoding =“UTF-8”):在'GIC上找到的不完整的最后一行   assessment.yml'

当我将其划分为空格时,我收到以下错误消息:

  

警告消息:在readLines(input,encoding =“UTF-8”)中:
  在“GIC评估2.yml”

上找到不完整的最后一行

我实际上尝试过一个yaml文件,我知道它特别适用于R(来自ahp的数据包),它也给了我上面的错误信息。

我完全失去了,任何想法都会受到高度赞赏。

我的档案是: 版本: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

0 个答案:

没有答案