This assignment is based on FC = 4000\(/year, TVC = 5000\)/year, and Q = 1000 fruits/year.
# Import libraries
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
library(ggplot2)
## [1] 4000
## [1] 5000
## [1] 1000
# រកចំណាយសរុប
TC <- FC + VC
TC
## [1] 9000
# រកចំណូលសរុប
TR <- q*p1~p
TR
## q * p1 ~ p
# រកចំណាយសរុប
TC <- FC + VC
TC
## [1] 9000
# រកចំណូលសរុប
TR <- q*p1~p
TR
## q * p1 ~ p
# រកថ្លៃដែលត្រូវលក់ដើម្បីឱ្យរួចដើម
P <- (q*p1~p1-TC)
P
## q * p1 ~ p1 - TC
p1 <- TC/q
p1
## [1] 9
# រកថ្លៃដែលត្រូវលក់ដើម្បីឱ្យចំណេញ 5000
p2 <- (TC+5000)/q
p2
## [1] 14
## 2. សង់ក្រាប
## First make functions
TR = makeFun(9*q~q)
TR
## function (q)
## 9 * q
TC = makeFun(4000+5*q~q)
TC
## function (q)
## 4000 + 5 * q
# Then, plot the graph
p = ggplot() +
geom_function(fun = TR, color="blue")+
geom_function(fun=TC, color="red")+
xlim(1, 1500) +
labs(x="ចំនួនទុរេន(ផ្លែ)",
y = "Money ($)")
p
s = p +
geom_text(aes(1250, 12000, label="TR"),
color="blue")+
geom_text(aes(400, 7000, label="TC"),
color="red")+
geom_text(aes(1000,9600,label="BEP"),
color="green")
s
## Add library
library(patchwork)
p+s