質問
私は光沢のあるもので始まり、データセットを使って仕事をして経験を得るために働いてきました。私はかなりの数回の反復のための簡単なコードをやり直していき、引数が得られ続けることはデフォルトなしで欠けています。誰かが私が欠けているものを見ていますか?
ui.R
=============================
library(shiny)
shinyUI(
pageWithSidebar(
headerPanel("Simple Cluster Example"),
sidebarPanel(
numericInput("var", "Cluster:", 2,
min = 2, max = 5, step = 1)),
mainPanel(
plotOutput("plot"),
#dataTableOutput("table")
)
)
)
-------------------------------
server.R
===============
library('shiny')
library('ggplot2')
shinyServer(function(input, output) {
protein <- read.csv("protein.csv")
vars.to.use <- colnames(protein) [-1]
pmatrix <- scale(protein[,vars.to.use])
pcenter <- attr(pmatrix, "scaled:center")
pscale <- attr(pmatrix, "scaled:scale")
d <- dist(pmatrix, method="euclidean")
pfit <- hclust(d, method="ward.D")
# This code is triggered whenever the drop-down menu is changed in the UI
component <- input$var
#rect.hclust(pfit, k=component)
groups <- cutree(pfit, k=component)
princ <- prcomp(pmatrix)
nComp <- 2
project <- predict(princ, newdata=pmatrix) [,1:nComp]
project.plus <- cbind(as.data.frame(project),
cluster=as.factor(groups),
country=protein$Country)
p <- ggplot(project.plus, aes(x=PC1, y=PC2)) +
geom_point(aes(shape=cluster))+geom_text(aes(label=country), hjust=0, vjust=1)
output$plot <- renderPlot({print(p)})
})
. 解決
あなたの問題は次のとおりです:
plotOutput("plot"),
.
「後に行をコメントアウトしたため)で終わると、新しい引数が期待されます。しかし、それはあなたのケースでは空です、それで余分な "、"。
所属していません StackOverflow