> r <- read.csv("p2.CSV") > r Product_no Product_name profit_percent Qty_on_hand Sell_price Cost_price 1 P001 Mouse 5 100 525 500 2 P002 Monitor 6 20 12000 11200 3 P003 CD 5 30 500 500 4 P004 DVD 5 200 50 40 5 P005 HDD 7 100 8400 8000 6 P006 Pendrive 4 90 500 450
> subset(r, (Cost_price>100 &Cost_price<600 &Sell_price>500)) Product_no Product_name profit_percent Qty_on_hand Sell_price Cost_price 1 P001 Mouse 5 100 525 500 > subset(r, (Cost_price>100)) Product_no Product_name profit_percent Qty_on_hand Sell_price Cost_price 1 P001 Mouse 5 100 525 500 2 P002 Monitor 6 20 12000 11200 3 P003 CD 5 30 500 500 5 P005 HDD 7 100 8400 8000 6 P006 Pendrive 4 90 500 450 > subset(r, (Cost_price<100)) Product_no Product_name profit_percent Qty_on_hand Sell_price Cost_price 4 P004 DVD 5 200 50 40 > subset(r, (Cost_price>100 &Cost_price<600)) Product_no Product_name profit_percent Qty_on_hand Sell_price Cost_price 1 P001 Mouse 5 100 525 500 3 P003 CD 5 30 500 500 6 P006 Pendrive 4 90 500 450 > subset(r, (Cost_price>100 &Cost_price<600 &Sell_price>500)) Product_no Product_name profit_percent Qty_on_hand Sell_price Cost_price 1 P001 Mouse 5 100 525 500
> min_sell_price<- min(r$Sell_price) > min_sell_price [1] 50 > max_sell_price<- max(r$Sell_price) > max_sell_price [1] 12000 > subset(r, Sell_price==min_sell_price | Sell_price==max_sell_price) Product_no Product_name profit_percent Qty_on_hand Sell_price Cost_price 2 P002 Monitor 6 20 12000 11200 4 P004 DVD 5 200 50 40
> head(r) Product_no Product_name profit_percent Qty_on_hand Sell_price Cost_price 1 P001 Mouse 5 100 525 500 2 P002 Monitor 6 20 12000 11200 3 P003 CD 5 30 500 500 4 P004 DVD 5 200 50 40 5 P005 HDD 7 100 8400 8000 6 P006 Pendrive 4 90 500 450 > subset(r, Cost_price>100, select = -Product_no) Product_name profit_percent Qty_on_hand Sell_price Cost_price 1 Mouse 5 100 525 500 2 Monitor 6 20 12000 11200 3 CD 5 30 500 500 5 HDD 7 100 8400 8000 6 Pendrive 4 90 500 450 > r1 <- read.csv("salesorder.xls") > r1 Order_no Product_no Qty_ordered Qty_disp 1 O001 P001 4 4 2 O001 P002 3 2 3 O001 P003 2 2 4 O002 P004 3 3 5 O002 P001 3 3 6 O003 P003 3 2 7 O004 P004 4 3 8 O004 P001 5 3 > head(r1) Order_no Product_no Qty_ordered Qty_disp 1 O001 P001 4 4 2 O001 P002 3 2 3 O001 P003 2 2 4 O002 P004 3 3 5 O002 P001 3 3 6 O003 P003 3 2
> subset(r, Cost_price>100, select = -Product_no) Product_name profit_percent Qty_on_hand Sell_price Cost_price 1 Mouse 5 100 525 500 2 Monitor 6 20 12000 11200 3 CD 5 30 500 500 5 HDD 7 100 8400 8000 6 Pendrive 4 90 500 450 > r1 Order_no Product_no Qty_ordered Qty_disp 1 O001 P001 4 4 2 O001 P002 3 2 3 O001 P003 2 2 4 O002 P004 3 3 5 O002 P001 3 3 6 O003 P003 3 2 7 O004 P004 4 3 8 O004 P001 5 3 > r1$Order_no [1] O001 O001 O001 O002 O002 O003 O004 O004 Levels: O001 O002 O003 O004
> r <- read.csv("p2.CSV") > r Product_no Product_name profit_percent Qty_on_hand Sell_price Cost_price 1 P001 Mouse 5 100 525 500 2 P002 Monitor 6 20 12000 11200 3 P003 CD 5 30 500 500 4 P004 DVD 5 200 50 40 5 P005 HDD 7 100 8400 8000 6 P006 Pendrive 4 90 500 450 7 P007 NA NA NA NA 8 P008 NA NA NA NA
> subset(r, Cost_price>100, select = -Product_no) Product_name profit_percent Qty_on_hand Sell_price Cost_price 1 Mouse 5 100 525 500 2 Monitor 6 20 12000 11200 3 CD 5 30 500 500 5 HDD 7 100 8400 8000 6 Pendrive 4 90 500 450
No comments:
Post a Comment