library(lpSolve)
## Warning: package 'lpSolve' was built under R version 3.3.2
obj.fun <- c(20, 60) # as in Z = 20x(1) + 60x(2)
constr <- matrix (c(30,20,5,10,1,1),ncol = 2, byrow = TRUE) # as in WH, MH, PM
constr.dir <-c("<=", "<=", ">=") # signs given for each constraint
rhs <- c(2700, 850, 95) # as were in the right-hand side
# Now, let's solve the model
prod.sol <- lp("max", obj.fun, constr, constr.dir, rhs, compute.sens = TRUE)
# Let's access R output of the solution
prod.sol$solution
## [1] 20 75
# Thus, x(1) = 20 and x(2) = 75