"Hello World"
head(iris)
?cut
summary(iris$Sepal.Length)
cut(iris$Sepal.Length, breaks = c(4, 5.2,6.1,7,8), right =T)
table(cut(iris$Sepal.Length, breaks = c(4, 5.2,6.1,7,8), right =T))
names(iris)
table(iris$Species,iris$Sepal.Length.Cat)
iris$Sepal.Length.Cat <- table(cut(iris$Sepal.Length, breaks = c(4, 5.2,6.1,7,8), right =T))
myiriscontable <- table(iris$Species,iris$Sepal.Length.Cat)
iris$Sepal.Length.Cat <- table(cut(iris$Sepal.Length, breaks = c(4, 5.2,6.1,7,8), right =T))
table(cut(iris$Sepal.Length, breaks = c(4, 5.2,6.1,7,8), right =T))
iris$Sepal.Length.Cat
table(iris$Sepal.Length.Cat,iris$Species)
iris$Sepal.Length.Cat <- table(cut(iris$Sepal.Length, breaks = c(4,5.2,6.1,7,8), right =T))
myiriscontable <- table(iris$Sepal.Length.Cat,iris$Species)
iris$Sepal.Length.Cat <- table(cut(iris$Sepal.Length, breaks = c(4,5.2,6.1,7,8), right =T))
myiriscontable <- table(iris$Sepal.Length.Cat,iris$Species)
iris$Sepal.Length.Cat <- table(cut(iris$Sepal.Length, breaks = c(4,5.2,6.1,7,8), right =T))
myiriscontable <- table(iris$Sepal.Length.Cat,iris$Species)
iris$Sepal.Length.Cat <- table(cut(iris$Sepal.Length, breaks = c(4,5.2,6.1,7,8), right =T))
myiriscontable <- table(iris$Sepal.Length.Cat,iris$Species)
iris$Sepal.Length.Cat <- table(cut(iris$Sepal.Length, breaks = c(4,5.2,6.1,7,8), right =T))
myiriscontable <- table(iris$Sepal.Length.Cat,iris$Species)
cut(iris$Sepal.Length, breaks = c(4,5.2,6.1,7,8), right =T)
iris$Sepal.Length.Cat <- cut(iris$Sepal.Length, breaks = c(4,5.2,6.1,7,8), right =T)
myiriscontable <- table(iris$Sepal.Length.Cat,iris$Species)
table(iris$Sepal.Length.Cat,iris$Species)
myiriscontable <- table(iris$Species,iris$Sepal.Length.Cat)
table(iris$Species,iris$Sepal.Length.Cat)
?cut()
summary(iris$Sepal.Length)
summary(iris$Sepal.Length)
table(iris$Species,iris$Sepal.Length.Cat)
myiriscontable <- table(iris$Species,iris$Sepal.Length.Cat)
addmargins(myiriscontable)
(iris$Sepal.Length, breaks = c(4,5.2,6.1,7.0,8), right =F)
cut(iris$Sepal.Length, breaks = c(4,5.2,6.1,7.0,8), right = F)
iris$Sepal.Length.Cat <- cut(iris$Sepal.Length, breaks = c(4,5.2,6.1,7.0,8), right = F)
iris$Sepal.Length.Cat <- cut(iris$Sepal.Length, breaks = c(4,5.2,6.1,7.0,8), right = F)
# Using the table() function
# Creating the contingency frequency table with row as the Sepal Species & column as the Sepal Length intervals that were created using the cut statement
#
myiriscontable <- table(iris$Species,iris$Sepal.Length.Cat)
# Adding the row and column margins (basically the frequency sum total of rows and columns)
addmargins(myiriscontable)
myiriscontable <- table(iris$Species,iris$Sepal.Length.Cat)
myiriscontable <- table(iris$Species,iris$Sepal.Length.Cat)
myiriscontable
# Adding the row and column margins (basically the frequency sum total of rows and columns)
# Add marginal frequency to the contingency table
addmargins(myiriscontable)
cut(pretty(iris$Sepal.Length))
cut(iris$Sepal.Length, pretty(iris$Sepal.Length))
table(cut(iris$Sepal.Length, pretty(iris$Sepal.Length)))
prop.table(myiriscontable)
prop.table(myiriscontable)
prop.table(myiriscontable,1)
prop.table(myiriscontable,2)
round(prop.table(myiriscontable,1),3)
round(prop.table(myiriscontable,2),3)
prop.table()
prop.table
methods(table)
method(table)
methods(table())
table(methods)
xp<-prop.table(x)
prop.table(x)
rowSums(xp)%o%colSums(xp)
?methods(table)
methods(class="table")
methods("table")
methods('table')
methods(Table)
methods(table)
methods(table())
?prop.table
11/4
dat <- c(68,69,74,76,79,87,88,90,93)
summary(dat)
IQR(dat)
dat <- c(68,69,74,76,79,87,88,90,93)
datsor <- sort(dat)
summary(datsor)
IQR(datsor)
dat1 <- c(3,5,7,8,12,13,14,18,21)
sumaary(dat1)
dat1 <- c(3,5,7,8,12,13,14,18,21)
summary(dat1)
0.25*length(dat1)
round(0.25*length(dat1))
0.25*length(dat1)
round(0.25*length(dat1))
0.75*length(dat1)
round(0.75*length(dat1))
dat1 <- c(3,5,7,8,12,13,14,18,21)
summary(dat1)
0.25*length(dat1)
pos <- round(0.25*length(dat1))
dat1[pos]
dat1[pos2]
pos2 <- round(0.75*length(dat1))
dat1[pos2]
dat <- c(68,69,74,76,79,87,88,90,93)
datsor <- sort(dat)
0.25*length(datsor)
round(0.25*length(datsor))
p25 <- round(0.25*length(datsor))
0.75*length(datsor)
p75 <- round(0.75*length(datsor))
dat <- c(68,69,74,76,79,87,88,90,93)
datsor <- sort(dat)
0.25*length(datsor)
p25 <- round(0.25*length(datsor))
p25
0.75*length(datsor)
p75 <- round(0.75*length(datsor))
p75
dat <- c(68,69,74,76,79,87,88,90,93)
datsor <- sort(dat)
0.25*length(datsor)
p25 <- round(0.25*(length(datsor)+1))
p25
0.75*length(datsor)
p75 <- round(0.75*(length(datsor)+1))
p75
summary(datsor)
IQR(datsor)
# this is also know as the 5 point summary. I admit that the summary function returns 6 points here but in statistics we commonly refer this kind of summary as 5 point summary
round(2.5)
length(dat1)
dat1 <- c(3,5,7,8,12,13,14,18,21)
summary(dat1)
pos <- round(0.25*(length(dat1)+1))
dat1[pos]
pos2 <- round(0.75*(length(dat1)+1))
dat1[pos2]
?quartile
?quantile
summary(datsor)
stu_grades <- c(68,69,74,76,79,87,88,90,93)
plot(stu_grades)
stu_grades <- c(68,69,74,76,79,87,88,90,93)
plot(stu_grades, label =T)
stu_grades <- c(68,69,74,76,79,87,88,90,93)
plot(stu_grades, label= 'T')
stu_grades <- c(68,69,74,76,79,87,88,90,93)
plot(stu_grades, labels = T)
?plot
stu_grades <- c(68,69,74,76,79,87,88,90,93)
hist(stu_grades)
stu_grades <- c(68,69,74,76,79,87,88,90,93)
hist(stu_grades, breaks = seq(68, 93, l= 2))
stu_grades <- c(68,69,74,76,79,87,88,90,93)
hist(stu_grades, breaks = seq(68,93,l= 2))
stu_grades <- c(68,69,74,76,79,87,88,90,93)
hist(stu_grades, breaks = seq(68,93,l=4))
plot(mydata$Sepal.Length)
1+29*0.30
1+ (29*0.30)
dat1 <- c(3,5,7,8,12,13,14,18,21)
summary(dat1)
fivenum(dat1)
<b>
<b>One dimentional statistical analysis and summary :
Bar Plot (for categorical feature)
Bar Plot
One dimentional statistical analysis and summary
One dimentional statistical analysis and summary 5 point statistical summary,Measures of central tendency,Scatter Plot,Box Plot,Histogram,Bar Plot
Matrix is a type of vector with the dimension attribute - the rows & the columns.  It stores the elements of same class type. We can have a character, integer, complex mode matrices and so on. The matrix cannot have elements of mixed modes.<br>
scores <- c(78,93,68,84,90,74,64,55,80)
scores
scores <- c(78,93,68,84,90,74,64,55,80) # Created the vector object scores using the c() function
scores # print the scores
scores <- c(78,93,68,84,90,74,64,55,80) # Created the vector object scores using the c() function
scores # print the scores
sort(scores) # sort the scores
scores
minscore <- min(scores) # minimum score in the sample
min(scores) # minimum score in the sample
max(score) # maximum score in the sample
min(scores) # minimum score in the sample
max(scores) # maximum score in the sample
median(score) #
median(scores)
?quartile
?quartiles
?quart
?quartile
?quantile
quantile(scores, 0.25)
quantile(scores)
quantile(scores)
quantile(scores, 0.25)
quantile(scores, 0.75)
quantile(scores, 0.75) # third quantile. Three quarter of the way from first to the 9th score.
# 75% of the scores are less than this score and 25% of the scores are more than this score
# another quick and easy way to obtain the five number summary statistics is by using the R summary() function.
summary(scores)
boxplot(scores, ylab = "Scores")
boxplot(scores, ylab = "Scores", ylim = c(50,100))
boxplot(scores, ylab = "Scores", ylim = c(20,100))
length(scores)
boxplot(scores, ylab = "Scores", ylim = c(50,100))
plot(sort(scores), type = 'b', xlab = "Students", ylab = "Scores", ylim = c(50,100))
p = plot(sort(scores), type = 'b', xlab = "Students", ylab = "Scores", ylim = c(50,100))
p
attributes(p)
p = plot(scores, type = 'b', xlab = "Students", ylab = "Scores", ylim = c(50,100))
p = plot(sort(scores), type = 'b', xlab = "Students", ylab = "Scores", ylim = c(50,100))
plot(scores, xlab = "Students", ylab = "Scores", ylim = c(50,100))
plot(sort(scores), xlab = "Students", ylab = "Scores", ylim = c(50,100))
scores <- c(78,93,68,84,90,74,64,55,80) # Created the vector object scores using the c() function
scores # print the scores
hist(scores)
?mtcars
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
shiny::runApp('Desktop/shiny')
Shiny tutorial
- shiny package and you should be ready
Shiny tutorial
========================================================
Shiny tutorial - Building Interactive Web apps straight from R using shiny
install.packages("ggmap")
library(ggmap)
install.packages("ggplot2")
library(shiny)
runExample()
runExample("05_sliders")
runExample("03_reactivity")
runExample("03_reactivity")
runExample("07_widgets")
shiny::runApp('Desktop/slider')
shiny::runApp('Desktop/slider')
shiny::runApp('Desktop/slider')
shiny::runApp('Desktop/slider')
shiny::runApp('Desktop/slider')
shiny::runApp('Desktop/slider')
shiny::runApp('Desktop/slider')
shiny::runApp('Desktop/slider')
shiny::runApp('Desktop/slider')
shiny::runApp('Desktop/slider')
shiny::runApp('Desktop/slider')
?sliderInput
shiny::runApp('Desktop/slider')
?sliderInput
?sliderInput
runExample()
runExample("05_sliders")
shiny::runApp('Desktop/slider')
runExample("05_sliders")
getwd()
library(shiny)
runExample()
runExample("01_hello")
shiny::runApp('Desktop/selectinput')
shiny::runApp('Desktop/selectinput')
shiny::runApp('Desktop/selectinput')
shiny::runApp('Desktop/selectinput')
shiny::runApp('Desktop/selectinput')
shiny::runApp('Desktop/selectinput')
runExample()
runExample("07_widgets")
runExample("02_text")
shiny::runApp('Desktop/selectinput')
shiny::runApp('Desktop/shinyasignment/hist')
shiny::runApp('Desktop/shinyasignment/hist')
shiny::runApp('Desktop/shinyasignment/hist')
shiny::runApp('Desktop/shinyasignment/hist')
getwd()
shiny::runApp('Desktop/shinyasignment/hist')
shiny::runApp('Desktop/shinyasignment/hist')
shiny::runApp('Desktop/shinyasignment/hist')
shiny::runApp('Desktop/shinyasignment/hist')
shiny::runApp('Desktop/shinyasignment/hist')
getwd()
setwd("/Users/MacBookPro/Desktop/downexp/")
getwd()
shiny::runApp()
?switch
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
library(shiny)
list.files()
runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
runExample()
runExample("03_reactivity")
runExample("10_download")
getwd()
setwd("/Users/MacBookPro/Desktop/downexp/reactive")
getwd()
list.files()
shiny::runApp()
Reactive function in Shiny (Reactive expressions)

So far we have seen render functions such as renderText(), renderPlot(), renderTable(). These functions are reactive – in the sense that they react towards any change in the input variable through the input widgets.

Another function in shiny having the reactive property is the reactive () function. Any expression given in the reactive function that depends on the input variable would change  (rather updates or re-evaluates) with any change in the input variable.

Why should we use the reactive function? 
Reactive expressions – when the expression is dependent on input variable and there is need for the expression to be reactive

Reusability – when you want the reactive function to evaluate an expression once and its value could be used within multiple render statements. That way the reactive expression need not to be calculated multiple time in each render statement.
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
getwd()
setwd("/Users/MacBookPro/Desktop/downexp/PNG/")
getwd()
shiny::runApp()
getwd()
setwd("/Users/MacBookPro/Desktop/R-Shinyapp-Tutorial/tabset verbatimTextOutput renderPrint - 2/")
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp()
shiny::runApp('~/Desktop/R-Shinyapp-Tutorial/download file')
shiny::runApp('~/Desktop/R-Shinyapp-Tutorial/download file')
shiny::runApp('~/Desktop/R-Shinyapp-Tutorial/download file')
shiny::runApp('~/Desktop/R-Shinyapp-Tutorial/download file')
shiny::runApp('~/Desktop/downexp/CSV')
