0
나는 15에서 20.25 시간 사이의 가능한 가장 긴 시간 간격으로 데이터 포인트를 표시하는 R로 첫 Shiny 앱을 만들려고 노력했습니다. dat은 24 시간 동안 모두 원래 데이터 테이블이며 초기화되었습니다. dat5를 새로운 시간 간격으로 슬라이더의 2 개 입력으로 새로운 데이터 테이블로 만들려고합니다. 내 코드는 아래에 있으며 실제 응용 프로그램에서이 오류가 나타납니다. 슬라이더가 좋은 것처럼 보이지만 "closure '형식의 개체는 하위 집합이 아닙니다. 어떤 도움이라도 대단히 감사하겠습니다. 이것은 내가 아래의 코드와 콘솔에지고있어 오류입니다 :첫 번째 반짝이는 앱에서의 오류
오류
Warning in if (!is.na(attribValue)) {
the condition has length > 1 and only the first element will be used
Warning in charToRaw(enc2utf8(text)) :
argument should be a character vector of length 1
all but the first element will be ignored
Warning in if (!is.na(attribValue)) { :
the condition has length > 1 and only the first element will be used
Warning in charToRaw(enc2utf8(text)) :
argument should be a character vector of length 1
all but the first element will be ignored
Warning: Error in $: object of type 'closure' is not subsettable
Stack trace (innermost first):
68: output$plot1
1: runApp
Warning messages:
1: In .HTMLsearch(query) : Unrecognized search field: title
2: In .HTMLsearch(query) : Unrecognized search field: keyword
3: In .HTMLsearch(query) : Unrecognized search field: alias
4: In .HTMLsearch(query) : Unrecognized search field: title
5: In .HTMLsearch(query) : Unrecognized search field: keyword
6: In .HTMLsearch(query) : Unrecognized search field: alias
코드 나는 간단한 작업 예를 구성
ui <- fluidPage(
sidebarLayout(
sidebarPanel(sliderInput(Tc, "Time Interval", min = 15, max =20.25,
2, value = c(15,20.25))),
mainPanel(
plotOutput("plot1")
)
)
)
server <- function(input, output, session) {
dat5 <- reactive({
dat5 <- copy(dat[Tc %between%c(input[1],input[2])])
})
output$plot1 <- renderPlot({
ggplot(dat2, aes(x = dat5$Tc, y = dat5$LastPrice)) +
geom_line(size = 2, alpha = 0.5) +
geom_point(size = 3) +
xlab("Time") +
ylab("Price")+
theme(text = element_text(size = 18),
legend.position = 'bottom')
})
}
shinyApp(ui = ui, server = server)
내가 한 후에는 오류 : reactvalues 객체의 단일 브래킷 색인 생성이 허용되지 않습니다. – CheddaShredda
왜 dat5를 dat5()라고해야하는지 모르겠습니다. 함수가 아닌 data.table이거나 뭔가 빠졌습니까? – CheddaShredda
이제 "ggplot2는 반응 형 클래스의 데이터를 처리하는 방법을 모릅니다."즉 반응 함수 내에서 무언가를 고쳐야한다는 것을 의미하지만, – CheddaShredda