This is what I have coded so far: I am trying for the reactive function to return the two values returned by the extractParams() function in functionName(). It does not work. I do not get the textOutput displayed. What is the right way of doing this?
ui <- fluidPage(
textOutput("list(value1, value2")
)
functonName <- function(sentvairble){
c(outL, numericL) %<-% extractParams(sentVariable) # the function that responds to this function call returns a list "list(outL, numericsL)
list(outL = outL, numericsL = numericsL)
}
extractParams <- function(sentVariable){
outL <- 1
numericsL <- 2
return(list(outL, numericsL))
}
server <- function(input, output){
output$checkedInput <- reactive({
output$list(value1, value2) %<-% renderText({
list(result1, result2) %<-% functionName(inFileName)
return(list(result1$outL, result2$numericsL))
})
}
You can only return one object in each R function, and the textOutput() just creates some html with that ID attached, that needs a renderText() to assign and change the HTML content and display your text.
Something like the below:
ui <- fluidPage(
textOutput("your_output")
)
functionName <- function(sent_variable){
# the function that responds to this
# function call returns a list "list(outL, numericsL)
extractParams(sent_variable)
}
server <- function(input, output){
output$your_output <- renderText({
#variable could be an input
two_value_list <- functionName(variable)
# turn the list into a single text string
paste("1:",two_value_list[[1]], "2:", two_value_list[[2]])
})
}
Thank you. If I use :
'''
return(paste("1:", returnedParam1, "2:", returnedParam2))
'''
I get the right results. How can I extract each value from the string?
I'm not sure what you want to extract each value from the string, but if you have a variable length of list you could perhaps do something like paste(1:length(result),":" ,unlist(result), collapse = ", ")
I am trying to use getwd() in shiny, but it returns NA. what can I use instead to get the path in the local directory of the server? Not the PC working directory.
Please delete this post. This is a different question.