1
간단한 선형 모델을 .rda
파일로 저장하여 가져오고 반짝이는 플렉스 대쉬 보드의 입력 세트에 적용하고 싶습니다.반짝이는 앱에 lm() 모델 적용
내 코드는 다음과 같습니다 : 나는이 문제를 해결하기 위해 할 수있는 일 cannot coerce class "c("reactiveExpr", "reactive")" to a data.frame
:
---
title: "Where Should I Publish My Piece?"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
runtime: shiny
---
```{r setup, include=FALSE}
library(flexdashboard)
library(shiny)
load('mods/mod.rda') # The lm() being imported
load('sections_list.rda') # A list of sections
```
Sidebar {.sidebar}
-----------------------------------------------------------------------
### Article Info
```{r}
renderText("Tell us a few things about your thing")
textInput(inputId = 'a',
label = 'What's a number?',
value = 1000)
selectInput(inputId = 'b',
label = 'What section are you using?',
choices = secs,
selected = secs[1])
selectInput(inputId = 'c',
label = 'What hour is it?',
choices = seq(0,23,1),
selected = 0)
selectInput(inputId = 'd',
label = 'What day of the week is it?',
choices = c("Thursday","Friday", "Saturday", "Sunday",
"Monday", "Wednesday", "Tuesday"),
selected = "Monday")
```
Columns {data-width=650}
-----------------------------------------------------------------------
### Predictions
```{r}
newdat <- reactive({
predict(mod,
newdata = data.frame(word_count = input$a,
section = input$b,
pub_hour = input$c,
dow = input$d))
})
renderTable({newdat})
```
나는 다음과 같은 오류를 받고 있어요? 나중에 newdat
을 그려보고 싶다면 (renderPlot({ggplot(newdat, yadayada)+geoms})
과 같이) 그렇게 할 수 있습니까?
는'renderTable이어야한다 ({newdat()})'나는 재미 새로운 오류에 저를 얻었다 – Chris
생각합니다. 이제'factor pub_hour has new level 0'을 얻었습니다. – Josh
신경 쓰지 마세요. 그것은 무관 한 문제였습니다. 고마워, 크리스! – Josh