Skip to content

R Lang: notes on developing a shiny app

commandline_be edited this page Dec 16, 2018 · 6 revisions

notes on developing a shiny app (and a small R intro)

This assumes you are just interested in analytics, not a scientist or datapro.

initializing a Shiny App

(minimalistic, untested for syntax & requirements)

 # load the shiny library (needs to be installed)
 library(shiny)

 # define the UI object and it's logic
 ui <- fluidPage(
   titlePanel("my title"),
   sidebarPanel(),
   mainPanel()
 )
 # define the server object and it's logic
 server <- function(input,output) { }

 # run the application
 shinyApp(ui = ui, server = server)

commands and stuff

Changing the working directory; once set commands default to this path depth

setwd("C:/developmentfolder/subfolder/ProjectX/")

Installing a package

install.packages(packageidname)

Installing a package from a specific repository (example value for repo)

install.packages(packageidname, repo="cran.rstudio.org")

notes on Packages

As indicated before not all packages are ready to install as binary on any platform. It may be manual installation is required. This basically means you're not on a supported platform. Usually this only means a little bit of extra work.

packages of interest

fs - a very complete filesystem library homepage here

ggplot2- excellent for quickly deploying graphs homepage here

IPtoCountry - map an IP to a country homepage here

simple use cases for the for mentioned libraries

library(fs)

read the files and folder on the current setpwd path

 dir_ls()

read relative to setpwd path

 dir_ls("subdir/subdir")

library(ggplot2)

not at at all here yet 👎 

library(IPtoCountry)

This library requires a number of dependencies such as digest, backports, lattice

install.packages("digest",dependencies = TRUE)
install.packages("backports",dependencies = TRUE)
install.packages("lattice",dependencies = TRUE)
Clone this wiki locally