小编Jam*_*e_B的帖子

RShiny UI 子选项复选框?

我有一个基本的 RShiny 应用程序,它有一个反应式复选框,它根据复选框中选择的数据(df 列)绘制时间序列数据。我当前的代码生成一个带有复选框输入的 UI,如下所示:

    # Load R packages
library(shiny)
library(shinyBS)

##example df in similar format to the data I'm working with
Both <- data.frame(
  Year  = c("1990", "1991", "1992", "1993"),
  SST_anomaly_GOM = c("-1.1", "0.23", "0.87", "-0.09"),
  SST_anomaly_GB = c("-1.1", "0.23", "0.87", "-0.09"),
  SST_anomaly_MAB = c("-1.1", "0.23", "0.87", "-0.09"),
  BT_anomaly_GOM = c("-2.5", "0.55", "1.20", "-0.19"),
  BT_anomaly_GB = c("-1.1", "0.05", "1.24", "-0.29"),
  BT_anomaly_MAB = c("-1.1", "-1.08", "0.67", "-2.40")
)

# Define UI
ui <- fluidPage(
  # useShinyBS
    "Visualizing Indicators", #app title …
Run Code Online (Sandbox Code Playgroud)

user-interface r checkboxlist shiny shinyapps

6
推荐指数
1
解决办法
130
查看次数

从 R 文本中提取文本引用(字符串)

我正在尝试编写一个函数,该函数允许我粘贴书面文本,并且它将返回写作中使用的文本内引用的列表。例如,这就是我目前拥有的:

pull_cites<- function (text){
gsub("[\\(\\)]", "", regmatches(text, gregexpr("\\(.*?\\)", text))[[1]])
    }
    
pull_cites("This is a test. I only want to select the (cites) in parenthesis. I do not want it to return words in 
    parenthesis that do not have years attached, such as abbreviations (abbr). For example, citing (Smith 2010) is 
    something I would want to be returned. I would also want multiple citations returned separately such as 
    (Smith 2010; Jones 2001; Brown 2020). I would also want Cooper (2015) returned as …
Run Code Online (Sandbox Code Playgroud)

regex text r citations gsub

3
推荐指数
1
解决办法
260
查看次数

标签 统计

r ×2

checkboxlist ×1

citations ×1

gsub ×1

regex ×1

shiny ×1

shinyapps ×1

text ×1

user-interface ×1