Problem Statement:
Using MongoDB create a database of employee performance, employee attendance on the workstation. Perform statistical analysis for the results of the products produced by employees rated as passed ok, damaged products ( 5 samples per batch size 1000) and the portion covered in the training and absentee of the employees during training. Use programming language R. (or R-Python/R-Java) or equivalent assignment using R Programming Language for BIGDATA computing.
query1.r
Using MongoDB create a database of employee performance, employee attendance on the workstation. Perform statistical analysis for the results of the products produced by employees rated as passed ok, damaged products ( 5 samples per batch size 1000) and the portion covered in the training and absentee of the employees during training. Use programming language R. (or R-Python/R-Java) or equivalent assignment using R Programming Language for BIGDATA computing.
PROGRAM
database
Last login: Tue Oct 14 13:58:41 on ttys000
Amols-MacBook-Air:~ Darwin$ mongo
MongoDB shell version: 2.6.4
connecting to: test
Server has startup warnings:
2014-10-14T13:59:01.288+0530 [initandlisten]
2014-10-14T13:59:01.288+0530 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
> use employee
switched to db employee
> db.createCollection("employee");
{ "ok" : 1 }
> db.employee.insert({"name":"brr1","presenty":90,"pass_rating":"pass","portion":80,"damaged_products":2});
WriteResult({ "nInserted" : 1 })
> db.employee.insert({"name":"brr2","presenty":95,"pass_rating":"pass","portion":70,"damaged_products":1});
WriteResult({ "nInserted" : 1 })
> db.employee.insert({"name":"brr3","presenty":85,"pass_rating":"fail","portion":75,"damaged_products":5});
WriteResult({ "nInserted" : 1 })
> db.employee.insert({"name":"brr4","presenty":75,"pass_rating":"fail","portion":85,"damaged_products":6});
WriteResult({ "nInserted" : 1 })
> db.employee.insert({"name":"brr5","presenty":71,"pass_rating":"pass","portion":78,"damaged_products":3});
WriteResult({ "nInserted" : 1 })
> db.employee.insert({"name":"brr6","presenty":79,"pass_rating":"fail","portion":87,"damaged_products":4});
WriteResult({ "nInserted" : 1 })
Last login: Tue Oct 14 13:58:41 on ttys000
Amols-MacBook-Air:~ Darwin$ mongo
MongoDB shell version: 2.6.4
connecting to: test
Server has startup warnings:
2014-10-14T13:59:01.288+0530 [initandlisten]
2014-10-14T13:59:01.288+0530 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
> use employee
switched to db employee
> db.createCollection("employee");
{ "ok" : 1 }
> db.employee.insert({"name":"brr1","presenty":90,"pass_rating":"pass","portion":80,"damaged_products":2});
WriteResult({ "nInserted" : 1 })
> db.employee.insert({"name":"brr2","presenty":95,"pass_rating":"pass","portion":70,"damaged_products":1});
WriteResult({ "nInserted" : 1 })
> db.employee.insert({"name":"brr3","presenty":85,"pass_rating":"fail","portion":75,"damaged_products":5});
WriteResult({ "nInserted" : 1 })
> db.employee.insert({"name":"brr4","presenty":75,"pass_rating":"fail","portion":85,"damaged_products":6});
WriteResult({ "nInserted" : 1 })
> db.employee.insert({"name":"brr5","presenty":71,"pass_rating":"pass","portion":78,"damaged_products":3});
WriteResult({ "nInserted" : 1 })
> db.employee.insert({"name":"brr6","presenty":79,"pass_rating":"fail","portion":87,"damaged_products":4});
WriteResult({ "nInserted" : 1 })
query1.r
#!/usr/bin/env Rscript
library(rJava)
library(RMongo)
mongo <- mongoDbConnect("employee","127.0.0.1","27017")
username = ""
password = ""
authenticated <- dbAuthenticate(mongo, username, password)
result<-dbGetQuery(mongo,"employee","{}",0,100) #here employee is my collection name
name<-result$name
pass_rating<- result$pass_rating
x<-factor(name)
y<-factor(pass_rating)
#X11() #calling the X11 windows graphics device!
plot(x=as.integer(x),y=as.integer(y),type = "l",xlab = "Employee", ylab = "Pass rating", axes = FALSE)
axis(side = 1, at = c(1:length(x)), labels = x)
axis(side = 2, at = c(1:length(levels(y))),labels = c("FAIL","PASS"))
dbDisconnect(mongo)
#message("Press enter to exit") #to print msg
#invisible(readLines("stdin",n=1))
#invisible(dev.off())
query2.r
#!/usr/bin/env Rscript
library(rJava)
library(RMongo)
mongo <- mongoDbConnect("employee","127.0.0.1","27017")
username = ""
password = ""
authenticated <- dbAuthenticate(mongo, username, password)
result<-dbGetQuery(mongo,"employee","{}",0,100)
names <- result$name
portion <- result$portion
iname <- as.integer(factor(names))
iportion <- c(0:100)
iportion <- seq(0,100,10)
fnames <- factor(names)
fportion <- factor(portion)
iportion <- as.integer(fportion)
#pdf(file="query2.pdf") #calling the pdf graphics device!
plot(x = iname,y = iportion,xlab = "Employee",ylab = "Portion covered in training", axes = FALSE,type = "b")
axis(side = 2,at = iportion, labels = factor(fportion))
axis(side = 1,at = iname,labels = factor(fnames))
dbDisconnect(mongo)
#invisible(dev.off())
query3.r
#!/usr/bin/env Rscript
library(rJava)
library(RMongo)
mongo <- mongoDbConnect("employee","127.0.0.1","27017")
username = ""
password = ""
authenticated <- dbAuthenticate(mongo, username, password)
result<-dbGetQuery(mongo,"employee","{}",0,100)
presenty <- result$presenty
presenty <- 100-presenty
fpresenty <- factor(presenty)
ipresenty <- as.integer(fpresenty)
#X11()
plot(x = iname,y = ipresenty,ylab = "Absenty",xlab = "Employee",type = "b",axes = FALSE)
axis(side = 1,at = iname,labels = factor(fnames))
axis(side = 2,at = ipresenty,labels = factor(fpresenty))
dbDisconnect(mongo)
#message("Press enter to exit")
#invisible(readLines("stdin",n=1))
#invisible(dev.off())
query4.r
#!/usr/bin/env Rscript
library(rJava)
library(RMongo)
mongo <- mongoDbConnect("employee","127.0.0.1","27017")
username = ""
password = ""
authenticated <- dbAuthenticate(mongo, username, password)
result <- dbGetQuery(mongo,"employee","{}",0,100)
name <- result$name
damage <- result$damaged_products
fname <- factor(name)
fdamage <- factor(damage)
iname <- as.integer(fname)
idamage <- as.integer(fdamage)
pdamage <- (idamage)/10
#png(file="brr.png",width=500,height=500) #calling the image graphics driver
plot(x = iname ,y = pdamage,xlab = "Employee", ylab = "Damage products 5 samples per batch size 1000 ",type = "b",axes = FALSE)
axis(side = 1,at = iname,labels = levels(fname),)
axis(side = 2,at = pdamage,labels = levels(pdamage),)
dbDisconnect(mongo)
#invisible(dev.off())
#message("Press enter to exit")
#invisible(readLines("stdin",n=1))
No comments:
Post a Comment