访问另一个函数中定义的函数变量

问题描述

我正在开发一个 Plumber Rest API,其中有两个函数 simplequeryGetData。所以我想访问或重用变量 (studies)函数 GetData 中的函数 simplequery 中,我在函数 simplequery 中使用的是 with function 和 { {1}}

例如:-

函数 simplequery

parent.frame

函数 GetData

simplequery<- function{
    with(parent.frame(),{
       studies <- get_studies(study_id = query) 
  
       associations <- get_associations(study_id = query)
  
       paste("Studies: ",n(studies),",Associations: ",n(associations))
    })
}

运行 api 后,我从函数 GetData <- function(query=""){ simplequery() # Get the data of Studies study_table <- studies@studies # Get the data of publication publications_table <- studies@publications # Get the data of genotyping_techs_table genotyping_techs_table <- studies@genotyping_techs # Get the data of platforms_table platforms_table <- studies@platforms list(study_table,publications_table,genotyping_techs_table,platforms_table) } 得到结果,但无法从函数 GetData 得到结果,得到错误

“eval(substitute(expr),data,enclos = parent.frame()) 中的错误:找不到对象‘输入’\n”

我不知道问题出在哪里

请帮忙!

提前致谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...