如何将R中的引号相乘?

时间:2018-09-13 19:55:14

标签: r expression

这段代码在我正在编写的函数中。我的问题出在最后两行。

cournot_2 = function(q0_1 = 0, c1 = 1, c1_2 = 0,
                 q0_2 = 0, c2 = 1, c2_2 = 0,
                 p_0, a = 1, b = 0) {

firm1 = quote(q0_1 + c1 * q1 + c1_2 * q1) ## firm 1's cost curve
firm2 = quote(q0_2 + c2 * q2 + c2_2 * q2) ## firm 2's cost curve
q = quote(q1 + q2) #total supply

demand = quote(p_0 + a*q + b * q^2) # market demand curve

mg_cost1 = D(firm1, "q1") #firm 1's marginal cost/ supply curve
mg_cost2 = D(firm2, "q2") # firm 2's marginal cost/ supply curve

profit1 = (mg_cost1*demand) - firm1 #each firm's profit curve
profit2 = (mg_cost2*demand) - firm2

mg_costidemand是引号,但是显然不能简单地通过使用“ *”运算来乘引号,这在乘以变量时是合适的。那么,我该怎么办?

0 个答案:

没有答案