提交按钮很有用,但我还没有找到一种优雅的方法来抑制初始页面加载时的输出.
例如,Shiny教程在加载时呈现输出.
http://rstudio.github.com/shiny/tutorial/#more-widgets
在按下提交按钮之前,如何确保不会调用任何反应函数?
以下是上面链接的示例的内联代码.
#ui.R
library(shiny)
# Define UI for dataset viewer application
shinyUI(pageWithSidebar(
# Application title.
headerPanel("More Widgets"),
# Sidebar with controls to select a dataset and specify the number
# of observations to view. The helpText function is also used to
# include clarifying text. Most notably, the inclusion of a
# submitButton defers the rendering of output until the user
# explicitly clicks the button (rather than doing it immediately
# when inputs change). This is …Run Code Online (Sandbox Code Playgroud) 我经常需要从data.frame中删除列列表.
我经常这样做:
to.remove <- c("hp","drat","wt","qsec")
mtcars[,-which(names(mtcars) %in% to.remove)]
Run Code Online (Sandbox Code Playgroud)
哪个工作正常.
但我希望能够以更清洁的方式使用subset.但它似乎附加了data.frame,然后将列名称作为变量而不是字符串来访问.
例如,这是我希望能够做到的:
subset(mtcars,select=-to.remove)
Run Code Online (Sandbox Code Playgroud)
有没有办法强制subset在select语句中使用字符串向量?还是有另一个更好的选择吗?
我一直在使用:_*转换Seq[String]到String*,我意识到,我不明白这是如何工作的引擎盖下.
有没有一种简单的方法来考虑这个?