library(lpSolve)
## Warning: package 'lpSolve' was built under R version 3.3.2
obj.fun <- c(0,0,0,0,-1) # as in P = -z
constr <- matrix (c(3,-2,-4,6,-1,-4,2,-1,-8,-1,0,-3,-2,-1,-1,1,1,1,1,0,-1,-1,-1,-1,0), ncol = 5, byrow = TRUE)  # as in WH, MH, PH, PM, MW
constr.dir <- c("<=", "<=", "<=", "<=", "<=") # signs given for each constraint
rhs <- c(0,0,0,1,-1)  # 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] 0.5714286 0.0000000 0.4285714 0.0000000 0.0000000