0

I'm having trouble storing my lpSolve solution in a c() object, when I execute.

l=c()
l[1]=lp ("min",f.obj,f.con,f.dir,f.rhs)

I get an error:

unexpected symbol in "l[1]"

Does someone have a clue please?

Thanks in advance!

C.J.Smith
  • 13
  • 3

1 Answers1

0

In order to add element in a list you need to do like below:

l <- list()
l[[1]] <- lp ("min",f.obj,f.con,f.dir,f.rhs)

If you want to add in a loop then you can try something like

l <- list()
i <- 1
while(<some condition>){
  l[[i]] <- "your lpSolve solution"
  i <- i+1
}
Prem
  • 11,775
  • 1
  • 19
  • 33