我想将用户选择保存为全局环境中的字符向量,以便在进一步分析中用作输入(my_choices下拉菜单) 如何保存选择的内容?
例子:
library("shiny")
library("shinyWidgets")
my_choices <- c(
"2018Q1","2018Q2","2018Q3", "2018Q4", "2019Q1", "2019Q2")
ui <- fluidPage(
pickerInput(
inputId = "id",
label = "SELECT PERIOD:",
choices = my_choices,
selected = NULL,
multiple = TRUE,
options = list(
`actions-box` = TRUE, size = 15, `selected-text-format` = "count > 3"
),
choicesOpt = list(
content = stringr::str_trunc(my_choices, width = 75)
)
),
verbatimTextOutput(outputId = "res")
)
server <- function(input, output, session) {
output$res <- renderPrint(input$id)
}
shinyApp(ui = ui, server = server)
Run Code Online (Sandbox Code Playgroud) 我想创建一个函数来运行一些检查并以类似的方式将诊断结果返回到终端devtools::check()。
devtools 使用颜色、多个其他符号(加载和“检查”等)。
有没有办法可以设计/编写这样的诊断程序?

我需要在计算机 A 和计算机 B 上镜像我的所有 Python 设置和模块。
我可以列出计算机 A 中的所有包/模块pip list,然后将它们一一安装在计算机 B 上 - 但实际上有大约 100 个包。
有没有更好/更快的方法来实现这一目标?
此外:
1)例如,当覆盖以前的安装时,我是否必须使用pip install --force-reinstall "pandas==0.23.0"?
2)有没有办法排除选定的包(一些个人的、冗余的模块)?
两台机器都是 Windows 并运行相同的 Python 版本。
我需要计算累积总和(基于组,列GroupNr),该总和在超过某个数字后重置,在本例中为 330。
这可以使用函数或 CTE 来完成吗?如果是这样,怎么办?
当前表
GroupNr Name Sum Cumsum
1 Mary 0.00 0.00
1 Jane 179.00 179.00
1 Tom 106.00 285.00
1 Joseph 175.00 460.00
1 Arthur 253.00 713.00
2 Mary 0.00 0.00
2 Jane 365.00 365.00
2 Tom 365.00 730.00
2 Joseph 365.00 1095.00
2 Arthur 365.00 1460.00
Run Code Online (Sandbox Code Playgroud)
预期表
GroupNr Name Sum Cumsum Resetcumsum
1 Mary 0.00 0.00 0.00
1 Jane 179.00 179.00 179.00
1 Tom 106.00 285.00 285.00
1 Joseph 175.00 460.00 460.00 -- Reset …Run Code Online (Sandbox Code Playgroud)