I can't believe I just discovered the function setNames in the 'stats' package. All it is is a wrapper to combine the two lines of code required to create a vector & assign its names. (It can also be used to add names to other objects, such as a list.) So, for instance, instead of:
How have I been living without this for so long!
> x<-c(1:3)
> names(x)<-c("one","two","three")
> x
one two three
1 2 3
We can do: > names(x)<-c("one","two","three")
> x
one two three
1 2 3
> x<-setNames(c(1:3),c("one","two","three"))
> x
one two three
1 2 3
> x
one two three
1 2 3
How have I been living without this for so long!