我想知道是否有人知道如何组合表格和 ggplot 图例,以便图例显示为表格中的一列,如图所示。很抱歉,如果之前有人问过这个问题,但我无法找到一种方法来做到这一点。
编辑:附加的是生成下面输出的代码(减去我正在尝试生成的图例/表格组合,因为我在 Powerpoint 中将其缝合在一起)
library(ggplot2)
library(gridExtra)
library(dplyr)
library(formattable)
library(signal)
#dataset for ggplot
full.data <- structure(list(error = c(0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4,
5, 6, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4,
5, 6, 0, 1, 2, 3, 4, 5, 6), prob.ed.n = c(0, 0, 0.2, 0.5, 0.8,
1, 1, 0, 0, 0.3, 0.7, 1, 1, 1, 0, 0.1, 0.4, 0.9, …Run Code Online (Sandbox Code Playgroud) 我是一个新手程序员,如果我不清楚或遗漏相关信息,请原谅。我编写了一个闪亮的应用程序,它从另一组代码导入数据帧。我想使用应用程序中的用户输入更新该数据框。我已经使用下面的代码将数据帧作为反应变量上传:
数据
current.shiny <- data.frame("Task" = as.character(c("Task 1", "Task 2", "Task 3")), "Completed" = as.character(c("Yes", "NO", "Yes")),"Date.Completed" = as.Date(c("2020-10-19","2020-10-20", "2020-10-21")))
Run Code Online (Sandbox Code Playgroud)
用户界面
ui<- fluidPage(
# Application title
titlePanel("Week of 11.02.2020"),
# Sidebar with reactive inputs
sidebarLayout(
sidebarPanel(
selectInput(inputId = "task.choice", label = "Task",
choices = c(as.list(current.shiny$Task))),
selectInput(inputId = "completed", label = "Completed?",
choices = c("Yes" = "Yes", "No" = "No")),
dateInput(inputId = "date.completed", label ="Date Completed"),
actionButton("update","Update Sheet")
),
# a table of reactive outputs
mainPanel(
mainPanel(
#DT::dataTableOutput("dt_table", width = 500) …Run Code Online (Sandbox Code Playgroud)