私はこれでかなり新しいので、おそらく簡単な説明があります。私は、水質観測のデータセットを使って作業しています。それはShinyを使ってプロットをビルドする際のエラー
Sample.ID,Sample.Date,Beach.Name,Sample.Location,Results,Units
050514CP13,5/5/2014,MIDLAND BEACH,Center,20,MPN/100 ml
062011GR04,6/20/2011,MANHATTAN BEACH,Left,0,MPN/100 ml
072808BH09,7/28/2008,MIDLAND BEACH,Right,28,MPN/100 ml
051214CP36,5/12/2014,SOUTH BEACH,Right,4,MPN/100 ml
081511KB07,8/15/2011,CEDAR GROVE,Left,360,MPN/100 ml
062909KB01,6/29/2009,MANHATTAN BEACH,Left,8,MPN/100 ml
082112KB07,8/21/2012,CEDAR GROVE,Left,20,MPN/100 ml
のようなオフを開始私は、次のui.R
library(shiny)
beaches <- read.csv("BeachWaterQuality.csv", header = TRUE)
beachNames <- levels(beaches$Beach.Name)
new.date <- strptime(beaches$Sample.Date, format="%m/%d/%Y")
minDate <- min(new.date)
maxDate <- max(new.date)
shinyUI(fluidPage(
# Application title
titlePanel("Beach Water Quality History"),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
selectInput("beach",
label = "Choose a beach to display",
choices = beachNames),
selectInput("sampleLocation",
label = "Choose a sample location",
choices = list("LEFT","CENTER", "RIGHT"),
selected="CENTER"),
dateRangeInput("dates",
label= "Choose a date range to display",
start=minDate,
end=maxDate)
),
# Show a plot of the selected data
mainPanel(
plotOutput("beachDataPlot")
)
)
))
そしてこのserver.R
library(shiny)
shinyServer(function(input, output) {
beaches <- read.csv("BeachWaterQuality.csv", header = TRUE)
beaches$Results[is.na(beaches$Results)] <- 0
beachNames <- levels(beaches$Beach.Name)
new.date <- strptime(beaches$Sample.Date, format="%m/%d/%Y")
beaches <- cbind(beaches,new.date)
output$beachDataPlot <- renderPlot({
plotData <- subset(beaches, Beach.Name==input$beach & Sample.Location==input$sampleLocation)
plot(x=plotData$new.date,
y=plotData$Results,
xlab="Date",
ylab="Bacterial Count",
pch=16,
main=paste("Bacterial Count for",input$beach,input$sampleLocation))
lines(plotData$new.date,plotData$Results,col="red")
})
})
私はこれを実行しようとすると、私はアプリでエラーを取得していと言う窓
Error: need finite 'xlim' values
そして、彼はコンソール
Warning in min(x) : no non-missing arguments to min; returning Inf
Warning in max(x) : no non-missing arguments to max; returning -Inf
Warning in min(x) : no non-missing arguments to min; returning Inf
Warning in max(x) : no non-missing arguments to max; returning -Inf
Warning: Error in plot.window: need finite 'xlim' values Stack trace (innermost first):
103: plot.window
102: localWindow
101: plot.default
100: plot
99: renderPlot [C:\Users\jerem\YuckyBeach/server.R#30]
89: <reactive:plotObj>
78: plotObj
77: origRenderFunc
76: output$beachDataPlot
1: runApp
誰でも私がここで間違っていることを指摘できますか?
'plotData'の行の数はいくつですか?それは0ですか? 'plotData < - subset(ビーチ、Beach.Name ==" SOUTH BEACH "&Sample.Location ==" Left ")'次に 'plot(x = plotData $ new.date、y = plotData $ Results) ' – kitman0804