At 02:36 PM 7/21/2007, Carol wrote:
Hi,
How to name the attributes of an object by name function? Why do I
get err msg?
thanks
x = c(1,2,3,4)
> names(x) = LETTERS[1:4]
Error in "names<-"(`*tmp*`, value = c("A", "B", "C", "D")) :
no applicable method for "names<-"
names(x) has to be a list of 4 strings.
LETTERS[1:4] is a single string 4 characters long.
Try
names(x)<- c('a','b','c','d')
================================================================
Robert A. LaBudde, PhD, PAS, Dpl. ACAFS e-mail: ral@lcfltd.com
Least Cost Formulations, Ltd. URL: http://lcfltd.com/
824 Timberlake Drive Tel: 757-467-0954
Virginia Beach, VA 23464-3239 Fax: 757-467-2947
"Vere scire est per causas scire"
================================================================
|