作者Lynnhan (林翰)
看板R_Language
标题[问题] RShiny Ui Server对应
时间Tue Nov 13 05:37:20 2018
[问题类型]:
程式谘询(我想用R 做某件事情,但是我不知道要怎麽用R 写出来)
[软体熟悉度]:
使用者(已经有用R 做过不少作品)
[问题叙述]:
最近在使用RShiny做图表
想问有经验的大大如何让这两个Ui 跟 Server连结起来
我是想做grouped bar plot 但一直无法将server的y
[程式范例]:
程式码可贴於以下网站:
UI:
sidebarPanel(
selectInput("var", "Select the variable from this dataset", choices =
c("English score" = mod_data$eperpospts, "math score" = mod_data$mperpospts)),
s我定义一个input名叫var 然後我想要让我的English score跟 math score是可以被选择的
Server:
ggplot(mod_data, aes(y=eperpospts, x = race, fill = highneeds)) +
stat_summary(fun.y = mean, geom = "bar", position = "dodge")
然後在y的部分一直无法跟Ui连结 想不到办法 不知道大大们有什麽建议
非常感谢
如果能帮忙的大大 我以200P作为答谢
[关键字]:
RShiny
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 65.96.232.71
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/R_Language/M.1542058643.A.41B.html
1F:→ TreeMan: 你server端的ggplot要用到input$var来控制你的y 11/13 07:43
3F:→ TreeMan: 你可以看一下UI的input 在server端如何被使用 11/13 07:45
4F:推 cywhale: 如果你的mod_data只在server端,你的UI(client端)要用它 11/13 08:06
5F:→ cywhale: 要用uiOuptut 请看Rstudio shiny Dynamic UI相关内容介绍 11/13 08:08
7F:→ cywhale: 在server端才明确把selectInput指定给这个uiOutput 然後 11/13 08:09
8F:→ cywhale: choices就可以使用server端的变数比如你要的mod_data$... 11/13 08:10