这是我的代码:
private void CheckOrder()
{
// this is working on a boxed copy
currentCount++;
Console.WriteLine("this.currentCount: {0}", currentCount);
// this is the global instance
Console.WriteLine("counters[0].currentCount: {0}", counters[0].currentCount);
}
我在做什么错了?
此外,我想为每个按钮制作一个ui <- fluidPage(
radioButtons("dist", "Distribution type:",
c("Sepal.Length" = "Length",
"Sepal.Width" = "Width",
"Petal.Length" = "Length")),
plotOutput("distPlot")
)
server <- function(input, output) {
output$distPlot <- renderPlot({
dist <- switch(input$dist,
"Length" = plot(iris$Sepal.Length),
"Width" = plot(iris$Sepal.Width),
"Length" = plot(iris$Sepal.Length))
plot(dist)
})
}
shinyApp(ui, server)
}
图。我该怎么办?
有帮助吗?
谢谢
答案 0 :(得分:2)
您不需要绘制分配的函数,因为import pandas as pd
from io import StringIO
x = """some,header,labels,for,each,column
1,hello,2,test,3,another
4,another,5,test,6,row
7,and,8,one,9,more"""
# get column names, replace StringIO(x) with 'file.csv'
df_cols = pd.read_csv(StringIO(x), nrows=0).columns
# skip even columns, replace StringIO(x) with 'file.csv'
df = pd.read_csv(StringIO(x), usecols=df_cols[::2])
print(df)
some labels each
0 1 2 3
1 4 5 6
2 7 8 9
it0已经这样做了。
switch
编辑:关于使用标准server <- function(input, output) {
output$distPlot <- renderPlot({
switch(input$dist,
"Length" = plot(iris$Sepal.Length),
"Width" = plot(iris$Sepal.Width),
"Length" = plot(iris$Sepal.Length))
})
}
的问题,尽管我对其他替代方案表示了评论,但这是我想出的替代方案:
(mfrow=c(1,2))