Business Analytics Unit 1
Business Analytics Unit 1
BBA 202
BBA IV SEM
Business Analytics
• Business Analytics is the discovery and communication of meaningful
patterns of data and that to business‐related problems.
• Pricing decisions
• Financial and marketing activities
• Supply chain management
• Management of customer relationships
• Human resource planning
• Enterprise resource planning
Business Analytics
• Importance of Business Analytics
R is a free, open-source language used as a statistical and visualization software. It can handle
structured as well as semi-structured data.
R is a powerful tool which was built for productivity in data analysis tasks from the outset.
Is available across all platforms, such as Linux, Mac, and Windows • Has the ability to
integrate with the procedures written in the C, C++, .Net, Python, or FORTRAN languages
• R is a free software.
• R is a statistical software where complex stats models like linear regression, logistic
regression, hypothesis testing, ANOVA(Analysis Of Variance), GLM(Generalized Linear Model),
etc., can be run.
• R has some great tools to aid data visualization to create graphs, bar charts, multi-panel
lattice charts, scatter plots, and new custom-designed graphics.
• ML algorithms like SVM, Naives Bayes theorem, XGboost, Decision tree, and Random forest
are available in R readily. These algorithms have proven to be better over time and provide
good accuracy of results.
• You can now write R codes in SAS as R codes are widely used, and programmers are getting
familiar with these. • R can handle semi-structured data and has algorithms built.
• Programmers can define their customized algorithms in R and develop their own
Introduction to R Programming Language
• (2) Console
• It is considered the brain of the R programming language and the IDE
used for running R- R Studio. In the console, you can write the code,
execute it and simultaneously see the output. Any code written in the
console, however, cannot be saved in the form of a script. Also, codes
that have been already executed in the console cannot be edited.
Interestingly, any code that is written in the code window is executed in
the console only.
Introduction to R Programming Language
• (3) Script
• Codes written in the code window can be saved as a .R file. This file is
commonly known as an R script. These scripts are helpful in sharing and
re-using the codes.
• (4) Operators
• These are symbols that allow us to perform certain operations. For
example, the Task performed using the function sum() can also be
performed using its operator, like this:
• sum(10,20) can also be performed using the + operator -> 10+20
Introduction to R Programming Language
• R is a comprehensive tool as it can take care of all the major aspects of the data
science domain these include-
• R programming
• Creating User-defined functions
• Automating certain tasks through loops etc
• Data Manipulation, Data Mining, and Data Visualization
• Almost all things done in MS Excel and SQL can be done in R
• Can perform all the Statical concepts that other languages such as SAS and SPSS can do
• This includes simple descriptive stats and applied inferential stats
• It can be used to create complex graphs
• Web Application
• R Shiny which can allow us to create a web-based application to create dashboards
Introduction to R Programming Language
Introduction to R Programming Language
Checking Data Type
• # numeric • class(x)
• x <- 10.5
• class(x) • # character/string
• x <- "R is exciting"
• # integer • class(x)
• x <- 1000L
• class(x) • # logical
• x <- TRUE
• # complex • class(x)
• x <- 9i + 3
Checking Data Type
max(5, 10, 15) paste(str1, str2)
10 > 9 TRUE
min(5, 10, 15) 10 == 9 FALSE
sqrt(16) 10 < 9 FALSE
abs(-4.7)
str1 <- "Hello"
str2 <- "World"
Checking Data Type
a <- 33 i <- 1
b <- 200 while (i < 6) {
print(i)
if (b > a) { i <- i + 1
print("b is greater than a") }
}
Introduction to R Programming Language
Introduction to R Programming Language
Introduction to R Programming Language
Introduction to R Programming Language
Introduction to R Programming Language
Introduction to R Programming Language
Introduction to R Programming Language
Introduction to R Programming Language
Introduction to R Programming Language
Key Ideas of R
Idea 1: Data is Separate From Analysis
• This states that each time we pass the same input to the function, we get the same answer. Second, functions do not
• All data analysis is a sequence of several functions applied one after another, each time producing a specific,
meaningful transformation of the input data. In devising these functions, we are splitting the analysis into a
sequence of small steps, each independent of the other. Any changes to the internal logic of this function do not
Data There is only one way to store data that is, Data Frame. A data frame is merely a
spreadsheet which is a kind of a structure with variables of interest arranged in columns and
the samples on which the variables have been measured arranged in the rows.
Functions and Composition For commonly used statistical functions such as mean() and
median() we do not need to enter any library. These are included when you enter the R
environment. The pipe operator provides an elegant way to organize nested computations.
Summarizing the Data
• 1.Vectors
• A sequence of elements of the same type.
• Created using the c() function.
print(num_vec)
print(char_vec)
print(class(num_vec))
print(class(char_vec))
Summarizing the Data
• 2. Lists
• Ordered collection of elements, which can be of different types.
• Created using the list() function.
print(my_list)
print(class(my_list))
Summarizing the Data
• 3. Data Frames
• Table-like structure where each column can contain different types of data.
• Created using the data.frame() function.
df <- data.frame(
)
print(df)
print(class(df))
Summarizing the Data