Seems like a lot of the similar questions asked on here do not have accepted answers and I haven't found anything that worked for me.
I'm creating a shiny app which has download buttons. on one page the download button needs to be moved down the page under all the plots.
this works for me but is hard coded:
output$saveGraphRob <- renderUI({
downloadButton("saveGraphRob1","Download", style = "margin-top:3500px")
})
what I want to do is allow for the style to be placed under all the graphs no matter how many there are. so if my plot_count()
is 6 for example, instead of 3500px it should be plot_count()*350.
trying this is returning the error: object 'top:' not found
output$saveGraphRob <- renderUI({
downloadButton("saveGraphRob1","Download", style = eval(parse(text=(paste0("margin-top:",plot_count()*350))))))
})
it's trying to evaluate the hyphen in margin-top as a minus sign, but I'm not sure what the workaround is.
Also open to other solutions to change the position of my download button.
The style=
parameter is just a character string. You should not be using eval(parse())
there (or almost ever with most R code). Just use style=paste0("margin-top:", plot_count()*350, "px")