Below are the solutions to these exercises on Building Shiny App. #################### # # # Exercise 1 # # # #################### #ui.R library(shiny) shinyUI(fluidPage( titlePanel(“Shiny App”), sidebarLayout( sidebarPanel(h2(“Menu”), br(), fluidRow( column(6, h4(“Help Text”), helpText(“Just for help”))), br(), fluidRow( column(6, numericInput(“numer”, label = h4(“Numeric Input”), value = 10))), fluidRow( column(6, h4(“Single Checkbox”), checkboxInput(“checkbox”, label = “Choice […]

# Solutions

## Data Hacking with RDSTK solution 3

Below are the solutions to these exercises on the RDSTK package ############### # # # Exercise 1 # # # ############### list=c("97.77.104.22","104.199.228.65","50.93.204.169","107.189.46.5","104.154.142.10","104.131.255.12","209.212.253.44","70.248.28.23","52.119.20.75","192.169.168.15","47.88.31.75 80","107.178.4.109","152.160.35.171","104.236.54.196","50.93.197.102","159.203.117.1","206.125.41.132","50.93.201.28","8.21.67.248 31","104.28.16.199") ############### # # # Exercise 2 # # # ############### df=data.frame(list) df[,1]=as.character(df[,1]) data=lapply(df[,1],ip2coordinates) df=do.call(rbind.data.frame,data) df ## ip.address dma_code latitude country_code3 area_code longitude ## 1 97.77.104.22 641 29.4717 USA 210 -98.5140 ## […]

## Data Science for Doctors – Part 3 : Distributions Solutions

Below are the solutions to these exercises on data display. #################### # # # Exercise 1 # # # #################### n <- 100 p <- 0.3 #a dbinom(34, n, p) ## [1] 0.05788395 sum(dbinom(34:n, n, p)) ## [1] 0.2207422 pbinom(34, n, p) ## [1] 0.8371417 #b sum(dbinom(30:60, n, p)) ## [1] 0.5376603 #c qbinom(0.025,n,p) ## […]

## Data Hacking with RDSTK 2 solution

Below are the solutions to these exercises on sorting and ordering. ############### # # # Exercise 1 # # # ############### library(RDSTK) ############### # # # Exercise 2 # # # ############### s1="statistics" s3="value" stringer= function(s2){ s1="statistics" s3="value" s2=as.character(s2) return(paste(s1,s2,s3, sep = ".")) } ############### # # # Exercise 3 # # # ############### stringer("hello") […]

## Building Shiny App solutions part 6

Below are the solutions to these exercises on Building Shiny App. #################### # # # Exercise 1 # # # #################### library(shiny) shinyUI(fluidPage( titlePanel(“Shiny App”), sidebarLayout( sidebarPanel(h2(“Menu”), br(), fluidRow( column(6, h4(“Actionbutton”), actionButton(“per”, label = “Perform”)), column(6, h4(“Help Text”), helpText(“Just for help”))), br(), fluidRow( column(6, numericInput(“numer”, label = h4(“Numeric Input”), value = 10))), fluidRow( column(6, h4(“Single […]

## Data Science for Doctors – Part 2 : Descriptive Statistics Solutions

Below are the solutions to these exercises on descriptive statistics. #################### # # # Exercise 1 # # # #################### mean(data[[‘mass’]]) ## [1] 31.99258 #OR sum(data[[‘mass’]])/length(data[[‘mass’]]) ## [1] 31.99258 #################### # # # Exercise 2 # # # #################### median(data[[‘mass’]]) ## [1] 32 #OR (sort(data[[‘mass’]])[length(data[[‘mass’]])/2] + sort(data[[‘mass’]])[length(data[[‘mass’]])/2+1] )/2 ## [1] 32 # This is a […]

## Multipanel Graphics in R (part 1) Solutions

Below are the solutions to these exercises on Multpanel Graphics in R. library(rgdal) #################### # # # Exercise 1 # # # #################### attach(iris) plot(Sepal.Length, Sepal.Width, col=’skyblue’, pch=1) title(“Sepal.Length vs Sepal.Width”) plot(Sepal.Length, Petal.Length, col=’magenta’, pch=2) title(“Sepal.Length vs Petal.Length”) plot(Sepal.Length, Petal.Width, col=’red’, pch=3) title(“Sepal.Length vs Petal.Width”) #################### # # # Exercise 2 # # # #################### […]

## Data Hacking with RDSTK (part 1) solution

Below are the solutions to these exercises on data hacking with RDSTK (part 1). ############### # # # Exercise 1 # # # ############### library(RDSTK) ############### # # # Exercise 2 # # # ############### stat=ip2coordinates(“165.124.145.197″) ############### # # # Exercise 3 # # # ############### stat$elevation=coordinates2statistics(stat[3],stat[6],”elevation”)[‘statistics.elevation.value’] ############### # # # Exercise 4 # # […]

## Data Science for Doctors – Part 1 : Data Display Solutions

Below are the solutions to these exercises on data display. #################### # # # Exercise 1 # # # #################### table(data[‘class’]) ## ## 0 1 ## 500 268 #################### # # # Exercise 2 # # # #################### pie(table(data[‘class.fac’])) # OR ggplot(data, aes(x = factor(1), fill = class.fac)) + geom_bar(width = 1) + coord_polar(theta = […]

## Multiple Regression (Part 2) Diagnostics – Solutions

Below are the solutions to these exercises on Multiple Regression (part 2). #################### # # # Exercise 1 # # # #################### #a. data(state) #b. state77 <- as.data.frame(state.x77) #c. names(state77)[4] <- “Life.Exp” names(state77)[6] <- “HS.Grad” #d. round(cor(state77),3) #displays correlations to 3 decimal places ## Population Income Illiteracy Life.Exp Murder HS.Grad Frost ## Population 1.000 0.208 […]