url <- "http://cran.us.r-project.org/src/contrib/Archive/cldr/cldr_1.1.0.tar.gz"
pkgFile<-"cldr_1.1.0.tar.gz"
download.file(url = url, destfile = pkgFile)
Run Code Online (Sandbox Code Playgroud)
安慰
>trying URL 'http://cran.us.r-project.org/src/contrib/Archive/cldr/cldr_1.1.0.tar.gz'
Content type 'application/x-gzip' length 2296083 bytes (2.2 MB)
==============================
downloaded 2.2 MB
install.packages(pkgs = pkgFile, type = "source", repos = NULL)
> Installing package into ‘C: / Users / v - xuawan / Documents / R / win -
library / 3.2’
(as ‘lib’ is unspecified)
* installing * source * package 'cldr' ...
** package 'cldr' successfully unpacked and MD5 sums checked
** libs
> …Run Code Online (Sandbox Code Playgroud) 我有一个ID列表(有些是重复的),我有一个KEEP变量.如果在KEEP列中有这样的实例,我想创建一个1或0的列,即使它不是那个特定的列
id <- c(101,101,101,102,102,102,103,103,103,104,104,106,107,108)
keep <- c("Y",0,0,"Y",0 ,0 ,"Y" ,0 ,0 ,0 ,0 ,0 ,0 ,0)
df <- data.frame(id, keep)
Run Code Online (Sandbox Code Playgroud)
我想创建第三列,如果保留列中有一个Y,则匹配所有ID.
看起来应该是这样的.
> df
id keep countkeep
1 101 Y 1
2 101 0 1
3 101 0 1
4 102 Y 1
5 102 0 1
6 102 0 1
7 103 Y 1
8 103 0 1
9 103 0 1
10 104 0 0
11 104 0 0
12 106 0 0
13 107 0 …Run Code Online (Sandbox Code Playgroud) 如何从第一个模块中传递选择的闪亮模块中调用闪亮模块?作为一个例子,我编写了一个应用程序来在 DT::data 表(模块StarWars)中显示来自dplyr 的星球大战主题。来自同一数据集的相关电影应显示在另一个子选项卡(模块电影)中的另一个 DT::data 表中。我通过在从模块的反应性值sw_rows_selected_rct表选择的受试者星球大战到模块薄膜,但在模块浏览器()语句薄膜不通过。
# Test call of modules inside modules
library(tidyverse)
#' Shiny StarWars module
#'
ui_Films <-
function(id,
title = id,
...,
value = title,
icon = NULL) {
ns <- shiny::NS(id)
tab <- tabPanel(title,
h4("StarWars Films"),
DT::dataTableOutput(outputId = ns("Films")))
}
ui_StarWars <-
function(id,
title = id,
...,
value = title,
icon = NULL) {
ns <- shiny::NS(id)
tab <- tabPanel(title,
DT::dataTableOutput(outputId = ns("StarWars")),
tabsetPanel(ui_Films(
id …Run Code Online (Sandbox Code Playgroud) 有没有办法单击dataTableOutput中的元素然后跳转到另一个tabPanel?
我知道使用escape = FALSE可以将url添加到table元素.但是如何将"跳转到不同的选项卡"添加到dataTableOutput元素?传递价值?
请看一下我可重复的例子.谢谢.
library(shiny)
server <- function(input, output) {
X = data.frame(
ID = c(
"<a href = 'http://www.google.com'> google </a>",
"Click here then Jump to tab2 and pass x=2 and y=2 to tab2",
"Click here then Jump to tab2 and pass x=3 and y=4 to tab2"
),
x = c(1, 2, 3),
y = c(10, 2, 4)
)
output$datatable = renderDataTable({X}, escape = FALSE,
options = list(
paging = FALSE,
searching = FALSE,
filtering = …Run Code Online (Sandbox Code Playgroud) 我想知道如何将一个模块中的反应式函数访问到另一个模块。如果我在一个模块中有多个反应性函数,我可以在另一个模块中访问它们吗?
所以基本上我将如何调用/传递一个闪亮模块中的反应函数到另一个闪亮模块(从一个模块到另一个模块的反应函数)谢谢
module1Ui <- function(id) {
ns <- NS(id)
wellPanel(selectInput(
ns("cars"),
"cars:",
list(
"Select" = "",
"a" = "mazda",
"b" = "ford"
)
))
}
module1 <- function(input, output, session) {
dataone <- reactive({
if (input$cars == "mazda") {
mtcars$mpg
}
else {
(mtcars$hp)
}
})
}
module2 <- function(input, output, session) {
dataone()
# here I want dataone from the above module1
# I tried to use callmodule(module1,_) but then didnt understand what the id would be in this …Run Code Online (Sandbox Code Playgroud)