[R] a question on list manipulation

Jannis bt_jannis at yahoo.de
Fri Aug 5 18:45:15 CEST 2011


toupper()/tolower()

are the functions to convert the letters.

lapply()

can be used to apply this to different list elements and

names()

is helpfull to convert the names of your list.



HTH
Jannis

On 08/05/2011 06:05 PM, zhenjiang xu wrote:
> Hi R users,
>
> I have a list:
>> x
> $A
> [1] "a"  "b"  "c"
> $B
> [1] "b"  "c"
> $C
> [1] "c"
>
> I want to convert it to a lowercase-to-uppercase list like this:
>> y
> $a
> [1] "A"
> $b
> [1] "A"  "B"
> $c
> [1] "A"  "B"  "C"
>
> In a word, I want to reverse the list names and the elements under
> each list name. Is there any quick way to do that? Thanks



More information about the R-help mailing list