You can convert this to list:
as.list(vx)$a
On Thu, Feb 25, 2010 at 6:53 PM, Matthias Gondan <matthias-gondan at
gmx.de> wrote:> Dear R developers,
>
> A great R feature is that elements of vectors, lists and dataframes can
have
> names:
>
> vx = c(a=1, b=2)
> lx = list(a=1, b=2)
>
> Accessing element "a" of vx: vx['a']
> Accessing element "a" of lx: lx[['a']] or lx$a
>
> Might be a matter of taste, but I like the $ very much. Unfortunately, vx$a
> is not
> functional. Would it break existing compatibility if the $ would be allowed
> to
> access elements of a vector, as well?
>
> Best regards,
>
> Matthias
>
> ______________________________________________
> 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