Closed cpanse closed 6 years ago
Firefox EST 52.8.1 (64-bit)
use firefox
the code snippet below might be a solution
> res <- list.files()[1:10]
> names(L) <- res
> res <- list.files()[1:10]
> L<- as.list(res)
> names(L) <- res
> names(L) <- paste(1:10, res)
> L
$`1 _____20170914_cmp.html`
[1] "_____20170914_cmp.html"
$`2 _____bfabric_save_importresource.py`
[1] "_____bfabric_save_importresource.py"
$`3 _____deisotoper_cmp_test_data.html`
[1] "_____deisotoper_cmp_test_data.html"
$`4 _____Esclapius_stick.png`
[1] "_____Esclapius_stick.png"
$`5 _____executable_16375_7227467413412645271.xml`
[1] "_____executable_16375_7227467413412645271.xml"
$`6 _____fgcz_dataFeederMascot.py`
[1] "_____fgcz_dataFeederMascot.py"
$`7 _____fgcz_ms_instrument_queue.json`
[1] "_____fgcz_ms_instrument_queue.json"
$`8 _____fgcz-queue-generator_2017-10-23.csv`
[1] "_____fgcz-queue-generator_2017-10-23.csv"
$`9 _____index_trans.html`
[1] "_____index_trans.html"
$`10 _____install_guide.pdf`
[1] "_____install_guide.pdf"
Based on Witold's idea of named lists, here a small code snipped how it works:
library(shiny)
if (interactive()) {
res <- "this is a really long name and Tobi and Laura would like it to be displayed in a shorter version so the see what they select in the input fields"
L<- as.list(res)
names(L) <- paste("file", 1, sep = "_")
shinyApp(
ui = fluidPage(
selectInput("state", "Choose a state:",
L
),
textOutput("result")
),
server = function(input, output) {
output$result <- renderText({
paste("You chose", input$state)
})
}
)
}
https://github.com/cpanse/bfabricShiny/blob/ca30a47fe20b43f3a717711536c97f675ac9d261/R/bfabric.R#L166