An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110305/654bd903/attachment.pl>
How to show non user defined data set such as cu.summary (from rpart)?
3 messages · John Edwards, Ista Zahn, Uwe Ligges
Hi John, Not sure how to do it with ls(), but easy enough with data(): data(package=library(base)) You'll need to consult both ?data and ?library to see why this works. labrary(base) could just as easily be library(stats) or whatever. Best, Ista
On Sat, Mar 5, 2011 at 4:36 PM, John Edwards <jhnedwards603 at gmail.com> wrote:
Hi All, ls() doesn't show cu.summary. ?ls says "When invoked with no argument at the top level prompt, \u2018ls\u2019 shows what data sets and functions a user has defined." Therefore, the reason ls() doesn't show cu.summary is because cu.summary is from a package but not user defined. Is there a way to show not only user defined data sets but also data sets from loaded packages?
library(rpart) str(cu.summary)
'data.frame': 117 obs. of ?5 variables: ?$ Price ? ? ?: num ?11950 6851 6995 8895 7402 ... ?$ Country ? ?: Factor w/ 10 levels "Brazil","England",..: 5 5 10 10 10 7 5 6 6 7 ... ?$ Reliability: Ord.factor w/ 5 levels "Much worse"<"worse"<..: 5 NA 1 4 2 4 NA 5 5 2 ... ?$ Mileage ? ?: num ?NA NA NA 33 33 37 NA NA 32 NA ... ?$ Type ? ? ? : Factor w/ 6 levels "Compact","Large",..: 4 4 4 4 4 4 4 4 4 4 ...
?ls ls()
character(0) -John ? ? ? ?[[alternative HTML version deleted]]
______________________________________________ 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.
Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psychology http://yourpsyche.org
Yes, after you have loaded rpart using library("rpart"), you will find
the search() list similar to this one:
R> search()
[1] ".GlobalEnv" "package:rpart" "package:psych"
"package:stats"
[5] "package:graphics" "package:grDevices" "package:datasets"
"package:utils"
[9] "package:fortunes" "package:methods" "Autoloads"
"package:base"
In order to list the contents of the environment of the rpart package,
use
ls(pos=2)
now.
Uwe Ligges
On 05.03.2011 17:36, John Edwards wrote:
Hi All, ls() doesn't show cu.summary. ?ls says "When invoked with no argument at the top level prompt, \u2018ls\u2019 shows what data sets and functions a user has defined." Therefore, the reason ls() doesn't show cu.summary is because cu.summary is from a package but not user defined. Is there a way to show not only user defined data sets but also data sets from loaded packages?
library(rpart) str(cu.summary)
'data.frame': 117 obs. of 5 variables: $ Price : num 11950 6851 6995 8895 7402 ... $ Country : Factor w/ 10 levels "Brazil","England",..: 5 5 10 10 10 7 5 6 6 7 ... $ Reliability: Ord.factor w/ 5 levels "Much worse"<"worse"<..: 5 NA 1 4 2 4 NA 5 5 2 ... $ Mileage : num NA NA NA 33 33 37 NA NA 32 NA ... $ Type : Factor w/ 6 levels "Compact","Large",..: 4 4 4 4 4 4 4 4 4 4 ...
?ls ls()
character(0) -John [[alternative HTML version deleted]]
______________________________________________ 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.