首页 > 解决方案 > 在 R 中运行 mplusModeler 包时如何解决错误?

问题描述

我正在尝试使用他们在线提供的数据来复制最近一篇论文所做的分析。我编写了以下代码,该代码基于朋友发给我的内容,因此我认为它可以工作并且很容易,但我不断收到错误。

我的代码是:

    rel_matrix = 0
    
    reldata <- read.spss('C:/Users/name/Desktop/project/Original_religious_data.sav', to.data.frame = TRUE)
    rreldata <- reldata[,c(14,17,19,31,32,33,34,47,48,49,50,51,52,53,54,55,56,59,60)]
    
    lpa1_rel <- mplusObject(
      TITLE = "1-Class Religious LPA;",
      VARIABLE = "USEVARIABLES = god_belief-att_toward_religion;
      CLASSES = c(1);",
      ANALYSIS = "ESTIMATOR = MLR;
      TYPE = MIXTURE;",
      MODEL = "
      %OVERALL%
      god_belief-att_toward_religion;
      [god_belief-att_toward_religion];
      %c#1%
      god_belief-att_toward_religion;
      [god_belief-att_toward_religion];",
      usevariables = c("god_belief", "belief_commitment", "certainty_super_belief", 
               "often_rel_practice", "attitude_rel_individuals",
               "freq_assoc_rel_indiv", "att_toward_religion"),
      rdata = rreldata)

    lpa1_rel_fit = mplusModeler(lpa1_rel, "rel.dat", modelout = "rel.inp", run = 1L)

但是当我运行代码时,我收到以下错误消息:

      Wrote model to: rel.inp
      File(s) with md5 hash matching data found, using 
      rel_d83664d7fbf3db75066c75d1e6ee4266.dat
      Error in file(file, ifelse(append, "a", "w")) : 
        cannot open the connection
      In addition: Warning message:
      In file(file, ifelse(append, "a", "w")) :
        cannot open file  'C:\Users\name\AppData\Local\Temp\RtmpGQSiAY\file365c60ac5b16': No such file or directory
      Error in file(out, "wt") : cannot open the connection
      Error: no more error handlers available (recursive errors?); invoking 'abort' restart

关于我所缺少的任何建议?

标签: rcompiler-errors

解决方案


推荐阅读