Pallavi BRM File
Pallavi BRM File
On
“BUSINESS RESEARCH METHODOLOGY”
Supervised By Submitted By
Dr. Simranjeet Kaur Bagga Name- Pallavi Sharma
Assistant Professor Roll No.70915101723
MERI
1
DECLARATION
I hereby declare that the following documented practical lab file titled “Business Research
Methodology” submitted by me to Management Education and Research Institute is a bonafide
work undertaken and has not been submitted to any other University or Institution for the award
of any degree diploma/certificate or published any time before.
I hereby certify that all the Endeavour put in the fulfilment of the task are genuine and original
to the best of my knowledge & amp; I have not submitted it earlier elsewhere.
Signature
Pallavi Sharma
BBA, 3rd (semester)
Enrolment No: 23MER0577
Roll no. 70915101723
2
INTERNAL GUIDE CERTIFICATE
To whomsoever it may concern
This is to certify that the practical lab file work “Business Research Methodology” made by
Pallavi Sharma, BBA, 3rd Semester is an authentic work carried out by her under the
supervision of Internal Guide Dr. Simranjeet Kaur Bagga.
The project report submitted has been found satisfactory for the partial fulfilment of the degree
of Bachelor of Business Administration.
3
ACKNOWLEDGEMENT
I have been very fortunate to get the opportunity to work on Practical Lab File, “Business
Research Methodology”. I hereby take this opportunity to express my profound gratitude
towards Guru Gobind Singh Indraprastha University for giving me an opportunity to work on a
valuable project.
I would like to extend my deepest regards and gratefulness to Dr. Simranjeet Kaur Bagga
ma’am, my project guide who continuously guided me throughout the course of the project.
Monitoring and constant encouragement throughout the course of this study made the successful
completion of this project possible.
Signature
Pallavi Sharma
BBA, 3rd (semester)
Enrolment No: 23MER0577
Roll no. 70915101723
4
TABLE OF CONTENTS
5
Introduction to R Studio
R is a popular programming language and software environment for statistical computing and
graphics. Developed in the 1990s by Ross Ihaka and Robert Gentleman, R is widely used by data
analysts, data scientists, researchers, and academics for data analysis, visualization, and
modeling.
1.1 Advantages of R
1. Free and Open-Source: R is free to download and use, with a large community contributing to
its development and maintenance.
2. Extensive Libraries: R has an vast array of libraries (over 18,000 packages) for various tasks,
including data visualization, machine learning, and statistical modeling.
3. Data Visualization: R provides excellent data visualization capabilities through libraries like
ggplot2, Shiny, and plotly.
5. Community Support: R has a massive and active community, ensuring there are numerous
resources available for learning and troubleshooting.
1.2 Disadvantages of R
6
1. Steep Learning Curve: R requires programming knowledge and can be challenging for
beginners.
2. Slow Performance: R can be slower than other programming languages, especially with large
datasets.
4. Limited Support for Parallel Processing: R's parallel processing capabilities are limited,
making it less suitable for massive computations.
5. Not Ideal for Real-Time Applications: R is primarily design ed for batch processing and may
not be the best choice for real-time applications.
1.3 R. Studio
RStudio is an integrated development environment (IDE) that makes R a bit more user-friendly.
While it is not the only way to use R, it provides a helpful and intuitive interface for writing and
editing code, as well as creating documents and reports. It is not, however, a requirement for
using the R language.
Additionally, it is important to note that R Studio is an entirely separate piece of software - it will
need to be downloaded separately from R.
In the upper-left corner is the source pane. This is the primarily location where most of your
work will take place. You will write and edit collections of code - or R Scripts - here. When
working in the source pane, your code will not compile untl you tell it to run; this allows you the
flexibility to work at your own pace, as well as to save your work.
7
In the lower-left corner is the console, or the command window. The console is the powerhouse
of the software; this is where R actually evaluates code. While you can type code directly into
the console and receive immediate results, it is advisable to stick to the source pane while you
are learning how to use R. Running code in the source pane will automatically produce output in
the console pane.
The upper-right quadrant contains the Environment and History tabs. The Environment tab
displays a list of all the data objects that you havae defined in your current R session, as well as
some basic details about the data (such as the number of observations and variables in each). The
History tab contains an archive of all the commands you’ve run in the current session.
Finally, the lower-right quadrant holds a number of helpful navigation tabs. The “Files” tab
displays your hard drive’s own file directory for easy access. The “Plots” tab will show the plots
and visualzations you have created in your current R session. The “Packages” tabs shows a list of
all the packages currently installed, as well as an indication of whther or not that are loaded in
the current session. The “Help” tab is, unsurprisingly, the help menu.
Until you are comfortable writing and executing code to analyze data, the RStudio interface can
seem intimidating. Remember - since these are open source software, there are plenty of
resources online to help as well. A “cheat sheet” for the RStudio IDE can be found here.
LS
Ls.Str
8
- ls.str(): Lists all objects in the current R environment, along with their structure.
rm
Class
Vector
In R, a vector is a one-dimensional array of elements of the same data type, such as numbers,
characters, or logical values. Vectors are the most basic data structure in R and are used to store
and manipulate data.
Matrix
A matrix is a two-dimensional array of elements of the same data type, with rows and columns.
List in R
A list is a collection of objects of different data types, including vectors, matrices, data frames,
and other lists.
Data Frame in R:
9
A data frame is a two-dimensional table of data with rows (observations) and columns
(variables). Each column contains data of one type (numeric, character, etc.), and each row
represents a single observation.
Loop Statements in R:
Types of loops:
3. Repeat Loop Similar to while loop but checks condition after execution in R.
10
Practical No. 1
Write a R program to take input from the user such as name and age and
print their value. Also join name and age and print their values.
> Age= 19
> print(Name)
> print(Age)
[1] 19
# Output
11
Practical No. 2
> b=c(1,2,3,4,5,6)
> print(b)
Output
[1] 1 2 3 4 5 6
> x=c(0+0i+0+0i+0+0i)
> print(x)
Output
[1] 0+0i
> z=c(TRUE,FALSE,TRUE,FALSE,TRUE,FALSE)
> print(z)
Output
>k=c("apple","mango","grapes","orange","strawberry","pinapple")
> print(k)
Output
12
[1] "apple" "mango" "grapes" "orange" "strawberry" "pinapple"
13
Practical No. 3
# arithmetic operator.
> vect1=c(0,2)
> vect2=c(2,3)
> paste("Addition")
[1] "Addition"
> a=vect1+vect2
> print(a)
Output
[1] 2 5
> paste("Subtraction")
[1] "Subtraction"
> b=vect1-vect2
> print(b)
Output
[1] -2 -1
> paste("Multiplication")
[1] "Multiplication"
14
> c=vect1*vect2
> print(c)
Output
[1] 0 6
> paste("Division")
[1] "Division"
> d=vect1/vect2
> print(d)
Output
# Logical operator
> vect1=c(0,2)
> vect2=c(2,3)
Equal
> print(paste("Equal",vect1==vect2))
Output
Not Equal
Output
Greater than
15
> print(paste("Greater than",vect1>vect2))
Output
Less than
Output
#Relational operators
vect3=c(10,20,30,40,50)
> vect4=c(5,10,15,20,25)
AND
> print(paste("AND",(vect3>20)&(vect4<20)))
Output
[1] "AND FALSE" "AND FALSE" "AND TRUE" "AND FALSE" "AND FALSE"
OR
> print(paste("OR",(vect3>20)/(vect4<20)))
Output
[1] "OR 0" "OR 0" "OR 1" "OR Inf" "OR Inf"
NOT
> print(paste("NOT",(vect3>20)))
Output
[1] "NOT FALSE" "NOT FALSE" "NOT TRUE" "NOT TRUE" "NOT TRUE"
16
Practical No.4
> x=c(10,20,30,40,50)
#Mean
> mean(x)
Output
[1] 30
> #Median
> median(x)
Output
[1] 30
> #Minimum
> min(x)
Output
[1] 10
> #Maximum
> max(x)
17
Output
[1] 50
> #Sum
> sum(x)
Output
[1] 150
> #Length
> length(x)
Output
[1] 5
18
Practical No.5
> a=c(1,2,3,4,5,6,7,8,9)
> matrix1=matrix(a,nrow=3,ncol=3,byrow=TRUE)
> matrix1[2,2]
[1] 5
> print(matrix1)
Output
[1,] 1 2 3
[2,] 4 5 6
[3,] 7 8 9
[1] "new matrix : 1" "new matrix : 4" "new matrix : 7" "new matrix : 2"
[5] "new matrix : 5" "new matrix : 8" "new matrix : 3" "new matrix : 6"
19
> matrix1[2,2]=100
> print(matrix1)
Output
[1,] 1 2 3
[2,] 4 100 6
[3,] 7 8 9
> a=matrix(c("A","B","C","D","E","F","G","H","I"),nrow=3,ncol=3,byrow=TRUE)
> print(a)
Output
> print(a[2,3])
Output
[1] "F"
> a[1,1]<-"x"
> a[2,3]<-"y"
20
> print(a)
Output
21
Practical No. 6
> print(ls)
Output
[[1]]
[1] 1 2 3 4
[[2]]
[[2]][[1]]
[1] "a"
[[2]][[2]]
[1] "b"
[[2]][[3]]
[1] "c"
22
[[2]][[4]]
[1] "d"
> print(class(ls))
[1] "list"
> list1=list("a","b","c","d")
> list2=list(c(1,2,3,4))
> mergelist=c(list1,list2)
> print(mergelist)
Output
[[1]]
[1] "a"
[[2]]
[1] "b"
[[3]]
[1] "c"
[[4]]
[1] "d"
23
[[5]]
[1] 1 2 3 4
24
Practical No. 7
Write a R program to create a data frame, merge two data frame also.
#Create a Vector
Employeeid= c(101,102,103)
print(df1)
df2=data.frame(Department)
print(df2)
y=cbind(df1,df2)
print(y)
#Output
25
[2] Department
1 Operation
2 Production
3 HR
26
Practical No. 8
Write a R program for loop statement such as if, elseif, for and while and
break statement.
>X=0
>if(x<0){
print(x)
>if(x<0){
} else if(x>0){
}else{
Print(“Zero”)
Output
[1]”Zero
> x=letters[4:10]
[1] "d"
27
[1] "e"
[1] "f"
[1] "g"
[1] "h"
[1] "i"
[1] "j"
> x=1
> #print 1 to 5
+ x= x+1 }
Output
[1] 1
[1] 2
[1] 3
[1] 4
> x=1
> #print 1 to 5
> repeat {
+ print(x)
+ x= x+1
+ if(x>5){
28
+ break
+ }
+ }
Output
[1] 1
[1] 2
[1] 3
[1] 4
[1] 5
29