renderText

Published by onesixx on

…Output 은 ui의 class나 html tag를 결정하고,
…render는 실제 내용의 형식을 결정한다.

renderText – textOutput

function에서 return받은 value 를 보여주기 위해 사용

ui <- fluidPage(
  textOutput("oID")
)

server <- function(input, output) {
  output$oID <- renderText({
     print("foo");
  })
}
... foo

renderPrint - vabatimTextOutput

function의 output을 capturing 하기 위해 사용.
(text value를 return하기보다는)

ui <- fluidPage(
  verbatimTextOutput("oID")
)

server <- function(input, output) {
  output$oID <- renderPrint({
     print("foo");
  })
}
  ....[1] "foo"

renderTable - tableOutput

ui <- fluidPage(
  tableOutput("oID")
)

server <- function(input, output) {
  output$oID <- renderTable({
    result <- data.table(mpg %>% head(3))
    return(result)
  })
}
....

renderUI - uiOutput, htmlOutput

ui <- fluidPage(
  uiOutput("oID")
)

server <- function(input, output) {
  output$oID <- renderUI({
    tagList(
      sliderInput("n", "N", 1, 1000, 500),
      textInput("label", "Label")
    )
  })
}
...

CSS

화면밖으로 Text가 나갈때 CSS

#oID .table {
  word-break: break-all;
}
#oID .table th {
  white-space: nowrap;
}

Categories: R-Shiny

onesixx

Blog Owner

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x