Hello,I am estimating a system of nonlinear equation where I need to stack my vector of y. I have data of about 6000units. I tried using the rbind but instead of having a vector of 1 by 18000, it is giving me a 3 by 6000 so that my matrix multiplication is non-conformable. The stack command requires an identifier but in this case, I do not have a unique identifier. I would like to stack the the first 6000 units of y1 on the 2nd 6000 units of y2 and 6000 units of y3. Any help will be greatly appreciated. ThanksOlufemi ? [[alternative HTML version deleted]]
Vectors are not "columns" or "rows". Use the c() function to concatenate vectors. --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. On April 29, 2015 6:56:46 PM PDT, Olufemi Bolarinwa <dafemlions at yahoo.co.uk> wrote:>Hello,I am estimating a system of nonlinear equation where I need to >stack my vector of y. I have data of about 6000units. I tried using the >rbind but instead of having a vector of 1 by 18000, it is giving me a 3 >by 6000 so that my matrix multiplication is non-conformable. The stack >command requires an identifier but in this case, I do not have a unique >identifier. >I would like to stack the the first 6000 units of y1 on the 2nd 6000 >units of y2 and 6000 units of y3. >Any help will be greatly appreciated. >ThanksOlufemi > >? > > [[alternative HTML version deleted]] > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >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.
Thank you Jeff for your response. My y1, y2, y3 are actually 3 columns in the data so I cannot use the c() function to concatenate them. I am confusing the "columns" with vectors. I actually meant columns. Any help will be much appreciated Olufemi? On Wednesday, 29 April 2015, 22:31, Jeff Newmiller <jdnewmil at dcn.davis.CA.us> wrote: Vectors are not "columns" or "rows". Use the c() function to concatenate vectors. --------------------------------------------------------------------------- Jeff Newmiller? ? ? ? ? ? ? ? ? ? ? ? The? ? .....? ? ? .....? Go Live... DCN:<jdnewmil at dcn.davis.ca.us>? ? ? ? Basics: ##.#.? ? ? ##.#.? Live Go... ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Live:? OO#.. Dead: OO#..? Playing Research Engineer (Solar/Batteries? ? ? ? ? ? O.O#.? ? ? #.O#.? with /Software/Embedded Controllers)? ? ? ? ? ? ? .OO#.? ? ? .OO#.? rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity.> wrote: >Hello,I am estimating a system of nonlinear equation where I need to >stack my vector of y. I have data of about 6000units. I tried using the >rbind but instead of having a vector of 1 by 18000, it is giving me a 3 >by 6000 so that my matrix multiplication is non-conformable. The stack >command requires an identifier but in this case, I do not have a unique >identifier. >I would like to stack the the first 6000 units of y1 on the 2nd 6000 >units of y2 and 6000 units of y3. >Any help will be greatly appreciated. >ThanksOlufemi > >? > >??? [[alternative HTML version deleted]] > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >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.[[alternative HTML version deleted]]
Here are two correct uses of the "stack command", if by that you mean the stack() function.> stack( data.frame(a=1:3, b=4:6, c=7:9) )values ind 1 1 a 2 2 a 3 3 a 4 4 b 5 5 b 6 6 b 7 7 c 8 8 c 9 9 c> stack( list(a=1:3, b=4:6, c=7:9) )values ind 1 1 a 2 2 a 3 3 a 4 4 b 5 5 b 6 6 b 7 7 c 8 8 c 9 9 c I would say that the "values" column of the output fits your description of what you want to do. (though I used names a, b, c instead of y1, y2, y3). But without a reproducible example, one can't say for sure. -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 4/29/15, 6:56 PM, "Olufemi Bolarinwa" <dafemlions at yahoo.co.uk> wrote:>Hello,I am estimating a system of nonlinear equation where I need to >stack my vector of y. I have data of about 6000units. I tried using the >rbind but instead of having a vector of 1 by 18000, it is giving me a 3 >by 6000 so that my matrix multiplication is non-conformable. The stack >command requires an identifier but in this case, I do not have a unique >identifier. >I would like to stack the the first 6000 units of y1 on the 2nd 6000 >units of y2 and 6000 units of y3. >Any help will be greatly appreciated. >ThanksOlufemi > > > > [[alternative HTML version deleted]] > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >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.