[R] Translation of matlab vectors code into r
Hi there I am new user of r, i would need some help to translate som code for vectors in matlab to r. I have managed to translate the first 7 rows, but not the rest. Could anyone give me any suggestions for this problem?? Matlab code: tempo=[]; temps=[]; tempn=[]; tempao=[]; tempas=[]; tempan=[]; for k=1:5 tempo = [tempo n_o(k,:)]; temps = [temps n_s(k,:)]; tempn = [tempn n_n(k,:)]; tempao = [tempao nanst_o(k,:)]; tempas = [tempas nanst_s(k,:)]; tempan = [tempan nanst_n(k,:)]; end. This is the code that i´m trying to translate into r, so far i have managed to translate the first 7 rows into r, but not last 6 rows. R-Code: tempao= vector() tempas= vector() tempan= vector() tempao= vector() tempas= vector() tempan= vector() for (k in 5:1) ? ? ? ? ? ? -- View this message in context: http://r.789695.n4.nabble.com/Translation-of-matlab-vectors-code-into-r-tp4612656.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Translation of Linear minimization probelm from matlab to r
Hi everyone, i´m a new user of R and i´m trying to translate an linear optimization problem from Matlab into r. The matlab code is as follow: options = optimset('Diagnostics','on'); [x fval exitflag] = linprog(f,A,b,Aeq,beq,lb,ub,[],options); exitflag fval x=round(x); Where: f = Linear objective function vector (vector of 45,rows) A = Matrix for linear inequality constraints (3colums 45 rows matrix) b = Vector for linear inequality constraints (3 rows vector) Aeq = Matrix for linear equality constraints (45 colums, 8 rows ) beq = Vector for linear equality constraints (8 rows vector) lb =Vector of lower bounds (45 rows) ub = Vector of upper bounds (45 rows) I have tryed the package "linprog" although i can´t find anyway to include the linear inequality constraints into the "solveLP" function. Can anyone please help me? -- View this message in context: http://r.789695.n4.nabble.com/Translation-of-Linear-minimization-probelm-from-matlab-to-r-tp4618123.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Upper an lower bound in linear programing
Hello everyone! I´m trying to solve a linear optimization problem with r using the LPsolve function and i want to set upper and lower bounds for the obejctive function. Any idea´s on how to do this?? -- View this message in context: http://r.789695.n4.nabble.com/Upper-an-lower-bound-in-linear-programing-tp4631202.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.