BDS306C
BDS306C
Module * I M t, C
Q.l a. Detennine the output of tbllorving R stalement. 5 t,3 col
i) c,(1,2,3, 4, 5) + C(6. 7, 8, 9, l0) ii) - I : 4* -2 :3
iii) identical(2^3,2**3) iv) 5:9%l% 2 v)C(2,4 2,1+ l)=6
b. Ilxplain the basic data types of R with examples l0 L2 col
e, Develop a R prograulr [u: lind the factorial ol' a given nurubcr usirrg 5 L3 col
recursive tirnction call.
OR
o.2 !1. Exrrlain repeat, rvhile and for loop with R progranrming cxamplc. l0 1,2 c()l
b. Develop R code to calculate the following financial metrics irr c"rrder tcr l0 I,3 col
assess the financial statenrent of an organization heing supplied 'uvith
2 vectors of data :
Monthly',Rcvenrre - [50. 60.70. 80.90. I00. I 10. 120. 130. 140. 155. 1651
and nronthly expenses: [30,35,40,45, 50, 55, 60, 65,70,75,80,85] fbr
the financial year
i) Profit for each month ii) profit after tax for each month (tax rate is 307r)
iii) profit margin fbr each rnonth iv) good rnonths and bad month wherc
profit after tax was greater tlran the mean and Iess than the rnean tbr the
ycal respectivel-y v) the bcst and worst rnr.rnth where thc pru{il aftcr tux lr,as
rnax ancl rnin ltrr lhe ycar respccl"ivcly
lllodult - 2
Q..3 a. Devclop a R"progtanr to crcate two 3 x 3 rrietrics A ani{ R aud Fcrltrnr tl'rc t0 I,3 COI
following operations
i) Transpose of the matrix ii) Addition iii) subtraction
iv) rnuhipliuatiun v) ar:cc$$,,the l-rrst rcnv olrnatrix A.
h. l)cscrihc thc thllo,,r,ing rvi,th Ii progrnnrrling exnr,nple l0 1,2 c()l
i) creation of list ii) assigning the names to elements of' the list
iii) Accessing the elements of the list index and names iv) convcrsion of
the vector to list v) cornbine two lists.
OR
Q.4 a. Determine the output of'fbllowing R statement 5 L3 COl
i) parts (C('pin', 'Red'), 'Apple')
ii) Substring ("The cat.is on the lvall"", 3, l0)
iii) Strsplit ("I like Banana, Orange and Pineapple,", " ")
iv) base name ("C :/progrzun Files/test.R")
v) g.t(S, :" Iabels: Cl('one'. 'two', 'tlrrt:c', 'four', "fivc'))
I of 3
p oaB
Fi u,Rlnv lp
t\
BD53O6C
Devclop R program to create a data frame with fbllowing details and clo the 10 L3 COI
* ftlllowing operations
&r.- on-E'g
7 Iterl cocle Item category Item price
l00l lllcctronics 700
r 002 Destop supplies 300
l 003 Office supplies 3s0
I 004 USB 400
100-s CD drive 800
i) Subset the Data frame and display the details of only those itetns
whosc price is greater than or equal to 350.
ii) Subset the Data fi'ame and display only the items wltere the category
is either "oftlcc supplics" or "Destop supplics"
iii) Clrcate another data {r'ames called "item - details" with three different
tlelds item code, IternQtyonHand and ltemReorderlvl and merge the
two data liames.
h. Design a data tranre in R fbr storing about 10 employee details. Creates a 10 L3 co2
CISV file named "input -CSV" that deflnes all the required infonnation
about the enlployee such as id, name, salary, start date dept. Impact into R
and do the following analysis.
i) Find the total number of rows and columns
ii) Find the nTaximum salary
iii) Retrieve the cletail of the cmployee rnaximum salary
iv) Retrieve all the employee in the IT department u,hose salary is greater
than 20000
v) Retrieve all the cmployee working in the lT department.
OR
Q.6 :1. With R program illustrate tlte concept of the tirllowing grouping function 10 L3 co2
i) apply ( ) ii) lapply ( ) iii) mapply( ) iv) rapply O v) tapply O.
b. Describe the ftinctions used fbr importing and cxporting unstructured files 4 L2 co2
with example prograrns.
Module * 4
Q.7 a. Wlite thc basic syntax for creating pie chart and explain the each pat'ameter 10 L3 co3
of'thr: function. Also wrile a R prclgratn to create a pie chart for the given
tist of'florvcrs with count IRose:25, Lotus:35, Lilly: 10. Sunflowers:
5, Jasrnine : 15], Draw the createcl pie chart.
2 of 3
6
i/r
;.\
p\ ilhT8f,g
OR
i\ /:
\'..r,t1^j. QiLl/
Q.8 a. With relevant graph illustrate veftical and horizorrtal bar plot using base r0 }T €d3
graphics with R program examples.
l\{odule * 5
Q.e a. Define the basic statistical rleasures msan,n, meaclian. ntocle. stanclarcl I I0
mocle. stanclarcl L3 co4
deviation and variance. AIso devebp R code ttl creatc a vector x "' f45, 56.
78,12,3, -91. -45, 15, l,Z4lard to find thebasic statistical llleastlres.
OR
Q.l0 a. avaialbe in R environment clcvelop It l0 L3 co4
rmmands to do the fbllowing :
i) Find the correlation between he horse power ("hp") and ttrileagc pcr
gallon ('1npg") of the cars
cars and plot "hp" Vs 'brpg" using plot
command
) F'ind the correiation between
using plot command
) Analvze the comelation befi
,\$ ."-
,* n#& .%.
&
#-" *;\
#p- s-"
&
dw
\s
$
3 of3
d ry
.&*
\