[R] str: how to use "no list" recursively?
Henrique Dallazuanna
wwwhsd at gmail.com
Sat Apr 10 18:01:44 CEST 2010
Try this:
cat(gsub(":List of .*", "", capture.output(str(x, no.list = TRUE))), sep = '\n')
On Fri, Apr 9, 2010 at 11:11 PM, Jeff Brown <dopethatwantscash at yahoo.com> wrote:
>
> Hi,
>
> In the help file for str(), the following line appears: "no.list logical;
> if true, no ‘list of ...’ nor the class are printed". However, that appears
> to be true only on the top level; setting no.list to TRUE still leaves the
> remaining levels with the `list of ...' statement intact:
>
>> x <- list(
> + a = list(list()),
> + b = list(list())
> + );
>> str(x)
> List of 2
> $ a:List of 1
> ..$ : list()
> $ b:List of 1
> ..$ : list()
>> str(x, no.list = TRUE)
> $ a:List of 1
> ..$ : list()
> $ b:List of 1
> ..$ : list()
>>
>
> For readability reasons, I'd like to keep the indented $ signs and the names
> of the sub-lists but suppress printing of `List of ...'. Is that possible?
>
> Thanks,
> Jeff
> --
> View this message in context: http://n4.nabble.com/str-how-to-use-no-list-recursively-tp1820073p1820073.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>
--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O
More information about the R-help
mailing list