r - 运行具有相同参数的多个函数,但它跳过第一个函数并使用 R 中的管道工打印第二个函数
问题描述
我有主函数,其中包括两个子函数在函数 fun1 和 fun2 中具有相同的参数,并且函数打印 fun2 但无法在 swagger 控制台中使用管道工打印 fun1 不知道为什么?
和
这是我的代码
library(plumber)
library(tibble)
#* @get /Query
detailData <- function(query = ""){
print(query)
library(gwasrapidd)
fun1(query)
fun2(query)
fun2 函数的输出,无法获取 fun1 函数
[
{
"study_id": "GCST002305",
"pubmed_id": 24325915,
"title": "Genome-wide association study identifies 25 known breast cancer susceptibility loci as risk factors for triple-negative breast cancer."
},
{
"study_id": "GCST010100",
"pubmed_id": 32424353,
"title": "Genome-wide association study identifies 32 novel breast cancer susceptibility loci from overall and subtype-specific analyses."
}
]
我想要单个对象中的两个功能,例如 fun1 是研究,而 fun2 是出版物
[
studies:{
"study_id": "GCST002305",
"gxe": false
},
{
"study_id": "GCST010100",
"gxe": false,
"snp_count": 9700000
},
publication{
"study_id": "GCST002305",
"pubmed_id": 24325915,
"title": "Genome-wide association study identifies 25 known breast cancer susceptibility loci as risk factors for triple-negative breast cancer."
},
{
"study_id": "GCST010100",
"pubmed_id": 32424353,
"title": "Genome-wide association study identifies 32 novel breast cancer susceptibility loci from overall and subtype-specific analyses."
}
]
解决方案
您不需要在管道工功能内打印。
library(plumber)
library(tibble)
library(gwasrapidd)
#* @get /query
function(query = ""){
list(query, fun1(query), fun2(query))
}
推荐阅读
- r - plot.new() 中的错误:R markdown 中的图形边距太大
- vue.js - VueJS - 如果选项少于 2 个,则禁用选择下拉菜单
- javascript - 如何使用 python selenium 从 chrome 控制台中查找 JS 元素
- oracle - 如何在 Oracle 中刷新 SELECT 的物化视图?
- android - Android无障碍服务-“不支持当前系统语言”
- javascript - 使用网络音频 api 播放 pcm 的正确方法是什么
- android - 是 ViewModel 还是 Fragment 中的 OnClickListener 和 OnLongClickListener?
- actions-on-google - 如何通过 REST API 请求创建或更新类型条目?
- rust - winit Rust crate 上的小包装器
- php - 比较来自不同数据库服务器的表