r - 基于用户输入的可变高度渲染图
问题描述
我正在尝试根据用户输入制作可变高度的渲染图。但是,我得到错误:找不到对象“x”:
server <- function(input, output, session) {
dat5<-reactive({
D5 %>%
filter(Parameter==input$analyte)})
output$plot1 <- renderPlot({
if (input$graph=='By subject') {
p<-ggplot(dat5(), aes(x=TALD.hr, y=Value, col=Parameter)) +
geom_line(aes(group = Parameter),lwd=0.9,show.legend = F) +
facet_wrap(as.formula(~Label),ncol=3)+
guides(shape=FALSE, colour=FALSE)
}
print(p)
x<-ifelse(input$graph=='By subject',length(unique(D5$Label)),length(unique(D5$Cycle2)))
}, height = function() {x*100},width = 800)
}
解决方案
推荐阅读
- rest - 使用 ElasticSearch 输出创建与请求路径值同名的索引
- android - 从 volley 的响应中检索 cookie
- qt - Qt:为什么 DPI 会随着操作系统的缩放而降低
- html - HTML 中的徽标图像未出现
- node.js - Angular-cli 和 npm 无法安装节点模块
- javascript - 尽管将字段的类型设置为 Float,但仍期望 Integer
- kotlin - 在行首使用数学运算符
- mysql - 如何通过按类型或ID区分该列将一列值显示到多列中
- python - 更改用户定义函数的错误类型
- javascript - 比较javascript中的两个DOM元素(正确的方法)?