2015-01-20 4 views
1

초보자는 다음과 같은 도움을 주시면 매우 감사하겠습니다.사용자 입력에서 샤이니로 시계열 그래프를 만듭니다.

  • 입력 (1-11 사이의 수치) 값 3
  • 출력 시계열 그래프 :

    난 날 수있는 간단한 데이터 애플리케이션을 작성하기를 바라고있다.

이렇게 할 수 없다면, 로짓 기능을 만드는 것이 그럴듯한가?

나는 3 개의 값이 부족하다는 것을 알고 있지만 요구에 따라 추가 할 수 있습니다. 여기

내가 가진 무엇

ui.R

shinyUI(pageWithSidebar( headerPanel("Time Series"), sidebarPanel(
textInput(inputId="text1", label = "Input Text1"), 
textInput(inputId="text2", label = "Input Text2"), 
textInput(inputId="text2", label = "Input Text2"), 
numericInput('Data', 'Time series', 
      min = 0, max = 11) ), mainPanel(
plotOutput('plot1') ))) 

server.R

require(graphics) 
shinyServer(function(input, output, session) { 
    # Combine the selected variables into a new data frame 
    selectedData <-   reactive({ ts <- reactive({ 
    ts(selectedData(), input$ts) }) 
    output$plot1 <- renderText({as.numeric(input$text1), as.numeric(input$text2, as.numeric(input$text3}) 
     par(mar = c(6.1, 4.1, 0, 1)) 
     plot(selectedData(), 
      col = ts()$ts, 
      pch = 20, cex = 3)) }) }) 
+0

나는 최종 목표의 요지를 얻을 수 없다. 시계열에 대해 정교 할 수 있는가? (무작위로 생성 되는가? 입력 되었습니까? 등) 및 입력을 재생할 역할을 원하십니까? – mlegge

+0

사과. 목표는 사용자가 입력으로 0-11 사이에 3 개의 선택 숫자를 지정하는 것입니다. (ui.R) 출력은 연결된 선 (server.R)을 보여주는 시계열 그래프입니다. 더욱 흥미로운 것은 예측 기능이지만이 시점에서는 너무 복잡 할 것입니다. –

답변

2

나는 당신에 입력 다중 값을 원하는거야 같은데 한 번, 각 점에 대한 숫자 입력 상자가 약간 번거로울 수 있습니다.

(참고 :. 당신은 그들이 웁니다 상자에 클릭으로 value는 즉시 기본 값을 지정한다)

복사 및 쉼표로 구분 된 데이터에 붙여 넣을 수 있도록 내가 만드는 자유를 촬영 한

ui.R

shinyUI(
    pageWithSidebar( 
    headerPanel("Time Series"), sidebarPanel(
    textInput("text", label = h6("Input comma delimited data"), value = "1.3, 2.9, 0.5, 2.1, 4.3") 
    ), 
    mainPanel(
     plotOutput('tsplot') 
    ) 
) 
) 

server.R

require(graphics) 

shinyServer(function(input, output, session) { 
output$tsplot <- renderPlot({ 
    x <- as.numeric(strsplit(input$text, split = ",")[[1]]) 
    ts.obj <- ts(x) 
    lowess.obj <- lowess(ts.obj, f = 10) 
    plot.ts(x, main = "Sample Time Series", xlab = "Time") 
    points(x) 
    lines(lowess.obj$y, col = "red") 
    legend("top", legend = "Loess Smoother", col = "red", lty = 1) 
}) 
}) 

enter image description here

+0

대단히 재능과 노력에 감사드립니다. –

+0

이 솔루션이 귀하의 질문에 대한 대답이라면, 귀하의 질문에 완전히 대답하기 위해 할 수있는 일을 알려주십시오. – mlegge

+0

merci, 그것입니다. –

관련 문제