[R] How can I get "A$Title"?

Bill.Venables@CMIS.CSIRO.AU Bill.Venables at CMIS.CSIRO.AU
Mon Dec 18 09:12:49 CET 2000


Here is one possibility.  First get the titles:

titles <- lapply(LETTERS, function(x) get(x)$Title)

Now you have them as a list, do whatever you want with them:

print(paste(unlist(titles), collapse = "\n"), quote = FALSE)

might be what you want.

Bill Venables.


> -----Original Message-----
> From: C. Joseph Lu [mailto:cjlu at ibm.stat.ncku.edu.tw]
> Sent: Monday, 18 December 2000 17:47
> To: 'r-help'
> Subject: [R] How can I get "A$Title"?
> 
> 
> Dear R-friends,
> 
> I have whole bunch of objects, say, A, B, ..., Z,
> all of them are "list" and haveing "Title" (a character string)
> as their first element.
> E.g.,
>   > A$Title
>   [1] "Airplane Component"
> 
> What I like to do is to find a way to printout all the Titles at one
> time.
> I tried the following:
>   >  paste(LETTERS, "Title", sep="$") -> tmp
> but can't find a way to continue since
>   > get(tmp[1])
>   Error in get(x, envir, mode, inherits) : variable "A$Title" was not
> found
> 
> Is there a way to create a vector of A$Title, B$Title, ... without
> double quotes?
> 
> My version is
> > version
>          _
> platform Windows
> arch     x86
> os       Win32
> system   x86, Win32
> status
> major    1
> minor    1.1
> year     2000
> month    August
> day      15
> language R
> 
> Best regards,
> 
> C. Joseph Lu
> Department of Statistics
> National Cheng-Kung University
> Tainan, Taiwan
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
> -.-.-.-.-.-.-.-.-
> r-help mailing list -- Read 
http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list