我正在尝试从 data.frames 列表中绘制多个图。我正在使用 Markdown 来呈现数据。在 R-Studio 中,当我单击“>”运行按钮时,我得到了所有的图。
我尝试使用的代码是:
### Plot each list
```{r plotSWBS6IByPhaseAndWave, echo=TRUE, eval=TRUE}
plotList <- list()
for(i in 1:length(seriesFigureSaleDataBS6I_PhaseWave)) {
plotList[[i]] <- plot_ly(data = seriesFigureSaleDataBS6I_PhaseWave[[i]],
x = ~priceDate,
y = ~amount,
color = ~actionFigurePackageName,
colors = "Pastel2",
type = "scatter",
mode = "markers") %>%
layout(title = paste("Phase", seriesFigureSaleDataBS6I_PhaseWave[[i]]$Phase, "& Wave", seriesFigureSaleDataBS6I_PhaseWave[[i]]$Wave))
}
# p <- lapply(seriesFigureSaleDataBS6I_PhaseWave, function(phaseWaveRow) plot_ly(data = phaseWaveRow, x = ~priceDate, y = ~amount, color = ~actionFigureUniqueId, colors = "Pastel2"))
print(class(seriesFigureSaleDataBS6I_PhaseWave))
print(summary(seriesFigureSaleDataBS6I_PhaseWave))
#rm(seriesFigureSaleDataBS6I_PhaseWave)
plotList
``` …
Run Code Online (Sandbox Code Playgroud) 我正在尝试在闪亮的数据表中创建一个操作按钮,单击该按钮会链接到特定的亚马逊产品。我按照R Shiny: Handle Action Buttons in Data Table建模了我的代码。单击该按钮时,我需要用户根据 data.table 行中的 ASIN 导航到特定的亚马逊产品页面。
filteredData <- data.frame(
Name = c('Dilbert', 'Alice', 'Wally', 'Ashok', 'Dogbert'),
ASIN = c("B06Y4VRZTB",
"B06Y4WGPBB",
"B06Y4J9Z9V",
"B06Y4V169H",
"B06Y4TF1D1"),
stringsAsFactors = FALSE,
row.names = 1:5)
shinyInput <- function(FUN, len, id, ...) {
inputs <- character(len)
for (i in seq_len(len)) {
inputs[i] <- as.character(FUN(paste0(id, i), ...))
}
print(inputs)
inputs
}
df <- reactiveValues(data = data.frame(
filteredData %>% mutate(Amazon.Button = shinyInput(actionButton,
nrow(filteredData),
'button_',
label = "Amazon",
onclick = paste0("window.open('https://",
AmazonSiteLink, …
Run Code Online (Sandbox Code Playgroud)