当我运行我的 Shiny 应用程序时,我的数据表的标题向左移动。见下文。假设这张表在选项卡 A 上。
当我单击不同的选项卡(选项卡 B)时,标题会正确对齐,然后再次单击选项卡 A。有关更正的标题,请参见下文。
知道是什么原因造成的吗?下面是我的代码的简化版本。提前致谢!
用户界面
library("shinythemes")
fluidPage(title = "Segmentation App", theme = shinytheme("spacelab"),
navbarPage("Segmentation", id = "allResults",
tabPanel(value='result_scorecard', title='ScoreCard',
sidebarLayout(
sidebarPanel(
h4("Select a cluster solution to profile"),
width = 3
),
mainPanel(
verticalLayout(
helpText(strong('Summary of Cluster Solutions')),
column(DT::dataTableOutput('out_best'), width = 12),
helpText(strong('ScoreCard Table')),
column(DT::dataTableOutput('out_scorecard'), width = 12)
)
)
)
),
tabPanel(value='profile', title='Profile',
verticalLayout(
column(DT::dataTableOutput('prop_by_cluster_ind'), width=10)
)
)
)
)
Run Code Online (Sandbox Code Playgroud)
服务器
function(input, output, session) {
best_sols <- reactive({
A <- c(100, 101, 201)
B …
Run Code Online (Sandbox Code Playgroud) 我是R的新手,我正在尝试对下面的代码进行矢量化.
有什么更好的方法呢?非常感谢!
*
l_mat <- data.frame(matrix(ncol = 4, nrow = 4))
datax <- data.frame("var1"= c(1,1,1,1), "Var2" = c(2,2,2,2), "Var3"=c(3,3,3,3), "Var4"=c(4,4,4,4))
for (i in 1:4) {
for (j in 1:4) {
if (datax[i, 2] == datax[j, 2]) {
l_mat[i, j] <- 100
} else {
l_mat[i, j] <- 1
}
}
}
Run Code Online (Sandbox Code Playgroud)
*
当我使用以下代码时,每个代码之间都有一条线。请参阅所附图片。
CODE:
helpText("method 1 = TwoStepCluster (Complete)"),
helpText("method 2 = TwoStepCluster (Ward.D2)"),
helpText("method 3 = TwoStepCluster (none)"),
helpText("method 4 = Fixed Solution used as a starting point"),
Run Code Online (Sandbox Code Playgroud)
我怎样才能在没有附加行的情况下显示结果?