Friday, February 24, 2017

Web page static elements using R Studio

We have seen that R Studio can be used to create Web Page using the 'Shiny' package. One of the first things to do is to create web content in HTML that can be rendered n a browser.

You can use a HTML wrapper function or use the individual wrapper functions of the various tags in formatting a web page. In most of the examples you can directly copy the code and paste it into the R studio console.

Here is an example of how you may wrap with HTML:

library(shiny)
ui <-fluidpage br="">  HTML("

Test

")
)
server <-function br="" input="" output="">
shinyApp(ui=ui, server=server)


This is how it gets rendered.


Static_00

In the following there are few more tags that are frequently used. I will try to get all of them in future posts.

Here are the tags a, h1 and br.

library(shiny)

ui <-fluidpage b="">a
(href="http://hodentek.blogspot.com",h1("Hodentek")),
               br(),a(href="http://hodentekMSSS.blogspot.com",
                      "Hodentek SQL Server Blog"))
server <-function br="" input="" output="">
shinyApp(ui=ui, server=server)

Static_01

Here are the tags h1 through h6, em and p:

library(shiny)
ui <-fluidpage br=""> h1("First Level"),
  h2("Second Level"),
  h3("Third Level"),
  h4("Fourth Level"),
  h5("Fifth Level"),
h6("Sixth Level"), p("some text"),em("italicized")
)
server <-function br="" input="" output="">shinyApp(ui=ui, server=server)


The rendered page is as shown:


Static_02

Look forward more of R Studio stuff here or 
here.







Post a Comment