From pperkins@ucsd.edu  Sat Aug 26 08:41:53 2000
From: pperkins@ucsd.edu (pperkins@ucsd.edu)
Date: Sat, 26 Aug 2000 09:41:53 +0200 (MET DST)
Subject: [Rd] unlisting a list with names components (PR#645)
Message-ID: <200008260741.JAA00333@pubhealth.ku.dk>

hi -

i apologize if this is a duplicate.

i think the lines below demonstrate a problem with unlist when the list
contains components that are names.  _anything_ can go in a list,
right?  this came up in the context of trying to
unlist(list(attr(terms(formula), "variables")).

perhaps unrelated but i thought i'd mention: unlist() complains about a
call/formula object, but sapply() does not (a call certainly "looks"
like a list, but includes names at some level).

- peter perkins


$ R --vanilla

> find(list)
[1] "package:base"
> find(unlist)
[1] "package:base"
> list1 <- list(a="a", b="b")
> unlist(list1)
  a   b
"a" "b"
> list2 <- list(a="a", b=as.name("b"))
> unlist(list2)
$a
[1] "a"

$b
b

> mode(list2)
[1] "list"
> mode(unlist(list2))
[1] "list"


--please do not edit the information below--

Version:
 platform = powerpc-unknown-linux-gnu
 arch = powerpc
 os = linux-gnu
 system = powerpc, linux-gnu
 status =
 major = 1
 minor = 1.1
 year = 2000
 month = August
 day = 15
 language = R

Search Path:
 .GlobalEnv, Autoloads, package:base



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] unlisting a list with names components (PR#645)
pperkins@ucsd.edu