Naitik Shah
Keen member
For the question mentioned in the subject, I have used a slightly different approach in comparison to the one produced in the ER. The maximum possible marks for the same question is 6. Do let me know the score that I would obtain using my method.
Answer in the Examiner's Report:
Median<- rep(0,5)
Mean<- rep(0,5)
Var<- rep(0,5)
for(i in 1:5)
{ Median<- median(salary.current[job.type==i] )
Mean<- mean(salary.current[job.type ==i] )
Var<- var(salary.current[job.type ==i] ) }
## Median # 9.180 9.285 9.410 10.160 10.030
## Mean # 9.168571 9.280333 9.440000 10.101333 10.119167
## Var # 0.07471261 0.02906540 0.00320000 0.03128381 0.05988106
My Solution: I have individually figured out the values and then copy-pasted the same.
In addition, I also wanted to understand when and in what situations am I supposed to use the FOR loop.
Thanks & Regards.
Answer in the Examiner's Report:
Median<- rep(0,5)
Mean<- rep(0,5)
Var<- rep(0,5)
for(i in 1:5)
{ Median<- median(salary.current[job.type==i] )
Mean<- mean(salary.current[job.type ==i] )
Var<- var(salary.current[job.type ==i] ) }
## Median # 9.180 9.285 9.410 10.160 10.030
## Mean # 9.168571 9.280333 9.440000 10.101333 10.119167
## Var # 0.07471261 0.02906540 0.00320000 0.03128381 0.05988106
My Solution: I have individually figured out the values and then copy-pasted the same.
In addition, I also wanted to understand when and in what situations am I supposed to use the FOR loop.
Thanks & Regards.