[R] Is it possible to have data stuctures like in C ?
Samuel.Plessis at cgm.cnrs-gif.fr
Mon Apr 7 16:17:17 CEST 2003
Ramon Diaz <rdiaz at cnio.es> writes:
|With regards to the second question, essentially everything in R (S) is an
|object. As a simple example, if you do:
|> x <- 1:5
|x is an object. It has attributes, there are methods appropriate for printing
|As for the first, the simplest thing to use would be a list, where you can
|have named components of different types.
|> y <- list(the.first.vector = 1:5, one.character = "a", another.vector =
|S4 classes do provide more sophisticated ways of dealing with classes, and
|they might be closer to what you expect from structs in C/C++ and classes in
|C++. S4 are thoroughly documented in Venables & Ripley's "S Programming" and
|in Chambers' "Programming with Data".
|But I think you problably should start with the introductory manuals (such as
|"An introduction to R", which comes with R) and then maybe move to Venables &
|Ripley's "S Programming".
|Hope this helps,
Thanks for help.
More information about the R-help