[R] rpanel / list error

jism7690 james.jism.carey at gmail.com
Fri Mar 9 12:59:17 CET 2012


Hi Michael,

Thank you for your reply. I have uploaded the minimum, I have left out the
formulas for calculating the amounts as they are not important to the loop.
Basically I have a while loop running that adds to the list of values and
then outside this loop I have a list called sis, this is the list that is
causing the error. I would like this list to return the values with panel,
before I used rpanel it was returning values perfectly.

Thanks

main <- function(panel)
{
with(panel,{

        LAST = 1100
        START = 0
        index = 0                           #### Starting Conditions
	revenue = 0
        minStock = panel$minStock
	maxStock = 100
	inventory = 100
	order_costs = 0
	storage_costs = 0
        orderlevel =panel$k
	sum = list(ninventory=inventory,order_costs=0,storage_costs=0,revenue = 0)
# initial list containing values

	while(index < LAST && inventory >0) {

	sum$order_costs = sum$order_costs + order_costs
        sum$storage_costs = sum$storage_costs + storage_costs
	sum$ninventory = sum$ninvenotry + inventory


  index = index + 1

}
})
	sis = list(Time = index,StorageCosts=sum$storage_costs,OrderCosts=
sum$order_cost,fInventory = sum$ninventory)
	return(sis)
 }


panel <- rp.control(title="Stochastic Case", size=panel.size)
rp.button(panel,action=main,title="Calculate",pos=pos.go.button)
rp.slider(panel,k,from=10,to=90,resolution=10,showvalue=TRUE,title="Select
Order Size",pos=pos.order.slider,initval=70)
rp.slider(panel,minStock,from=10,to=90,resolution=10,pos=pos.minstock.slider,initval
= 50,title="Minimum Stock Level",showvalue=TRUE)



--
View this message in context: http://r.789695.n4.nabble.com/rpanel-list-error-tp4457308p4459254.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list