I am developing a Plumber Rest API where i have two function simplequery
and GetData
. So i want access or reuse variable (studies) in function GetData
from function simplequery
where I have used in function simplequery
iswith function
with parent.frame
for example :-
function simplequery
simplequery<- function{
with(parent.frame(),{
studies <- get_studies(study_id = query)
associations <- get_associations(study_id = query)
paste("Studies: ", n(studies), ",Associations: ", n(associations))
})
}
Function GetData
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)
}
After running the api I get the result from function GetData
but unable to get the result from function simplequery
getting error
"Error in eval(substitute(expr), data, enclos = parent.frame()): object 'input' not found
"
i don't know where the problem is
Please Help!
Thank you in Advance
question from:
https://stackoverflow.com/questions/66050366/access-defined-variable-of-function-in-another-function 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…