[R] listing components of an object

Patrick Burns pburns at pburns.seanet.com
Mon Mar 3 10:31:36 CET 2008


Does

names(obj)

do what you want?


Patrick Burns
patrick at burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")

Nair, Murlidharan T wrote:

>Is there a method to list the components of an object, instead of looking at the help for that method?  Let me be more clear with an example
>
>data(iris)
>  ## tune `svm' for classification with RBF-kernel (default in svm),
>  ## using one split for training/validation set
>
>  obj <- tune(svm, Species~., data = iris,
>              ranges = list(gamma = 2^(-1:1), cost = 2^(2:4)),
>              tunecontrol = tune.control(sampling = "fix")
>             )
>
>  ## alternatively:
>  ## obj <- tune.svm(Species~., data = iris, gamma = 2^(-1:1), cost = 2^(2:4))
>
>  summary(obj)
>  plot(obj)
>---------------------------------
>For tune, an object of class tune, including the components:
>
>best.parameters a 1 x k data frame, k number of parameters.
>best.performance best achieved performance.
>performances if requested, a data frame of all parameter combinations along with the corresponding performance results.
>train.ind list of index vectors used for splits into training and validation sets.
>best.model if requested, the model trained on the complete training data using the best parameter combination.
>
>I got the above by doing ?tune.
>
>Is there a function that helps be do this?
>Thanks ../Murli
>
>______________________________________________
>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.
>
>
>  
>



More information about the R-help mailing list