library(mosaic)
## Registered S3 method overwritten by 'mosaic':
##   method                           from   
##   fortify.SpatialPolygonsDataFrame ggplot2
## 
## The 'mosaic' package masks several functions from core packages in order to add 
## additional features.  The original behavior of these functions should not be affected by this.
## 
## Attaching package: 'mosaic'
## The following objects are masked from 'package:dplyr':
## 
##     count, do, tally
## The following object is masked from 'package:Matrix':
## 
##     mean
## The following object is masked from 'package:ggplot2':
## 
##     stat
## The following objects are masked from 'package:stats':
## 
##     binom.test, cor, cor.test, cov, fivenum, IQR, median, prop.test,
##     quantile, sd, t.test, var
## The following objects are masked from 'package:base':
## 
##     max, mean, min, prod, range, sample, sum
  library(mosaicCalc)
## 
## Attaching package: 'mosaicCalc'
## The following object is masked from 'package:stats':
## 
##     D
  FC = 4000
  TVC = 5000
  Q = 1000
  
  ##រកថ្លៃរួចដើម
  TR = (FC+TVC)
  
  P = (FC+TVC)/Q
  P
## [1] 9
  ##រកថ្លៃចំណេញប្រាក់5000$
  
  TR = (FC+TVC+5000)
  
  P = (FC+TVC+5000)/Q
  P
## [1] 14
##plot graphic  
  
  TR= makeFun(9*q~q)
  TR
## function (q) 
## 9 * q
  TC= makeFun(4000+5*q~q)
  TC
## function (q) 
## 4000 + 5 * q
ggplot()+  
 geom_function(fun=TR, col="red")+ 
 geom_function(fun=TC,col="blue")+ 
xlim(1,5000)+
  
  labs(x="Q", y = "Money ($)")+

geom_text(aes(4000, 40000, label="TR"),
          color="red")+
geom_text(aes(4500,30000 , label="TC"),
            color="blue")+
 
 geom_text(aes(900,12500),label="BEP",col="green")