Matlab has an aggregate variable called a structure, which consists of component variables each of which can be of a different data type and dimension. For example, I can have a single structure Model which consists of Model.variable1, Model.variable2, and Model.variable3, where variable1 is a string variable, variable 2 is a 1x24 vector, and variable 3 is a 6x6x6 array. The benefit is that the aggregate variable Model can be passed between programs without having to pass each of the component variables. Does R have anything similar?
Hello - Scott Romans wrote:> Matlab has an aggregate variable called a structure, which consists of > component variables each of which can be of a different data type and > dimension. For example, I can have a single structure Model which > consists of Model.variable1, Model.variable2, and Model.variable3, > where variable1 is a string variable, variable 2 is a 1x24 vector, and > variable 3 is a 6x6x6 array. The benefit is that the aggregate > variable Model can be passed between programs without having to pass > each of the component variables. Does R have anything similar? >These are objects of class "list" in R and play a very important role when using and programming R. See ?list, "An Introduction to R" on CRAN, or any introductory book on R to learn about lists. Best, Erik Iverson> ______________________________________________ > R-help at 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.
?list On 13/03/2008, at 3:50 PM, Scott Romans wrote:> Matlab has an aggregate variable called a structure, which consists of > component variables each of which can be of a different data type and > dimension. For example, I can have a single structure Model which > consists of Model.variable1, Model.variable2, and Model.variable3, > where variable1 is a string variable, variable 2 is a 1x24 vector, and > variable 3 is a 6x6x6 array. The benefit is that the aggregate > variable Model can be passed between programs without having to pass > each of the component variables. Does R have anything similar? > > ______________________________________________ > R-help at 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.###################################################################### Attention:\ This e-mail message is privileged and confid...{{dropped:9}}