[R] How to generate labels or names?

Christoph Buser buser at stat.math.ethz.ch
Thu Jan 27 18:32:18 CET 2005


Hi Eric

If you want produce a vector with names, you can use

v <- rnorm(20)
names(v) <- paste("Lab",1:20, sep="")

Regards,

Christoph

--------------------------------------------------------------
Christoph Buser <buser at stat.math.ethz.ch>
Seminar fuer Statistik, LEO C11
ETH (Federal Inst. Technology)	8092 Zurich	 SWITZERLAND
phone: x-41-1-632-5414		fax: 632-1228
http://stat.ethz.ch/~buser/
--------------------------------------------------------------


Eric Rodriguez writes:
 > Hi,
 > 
 > I'm new to R and I would like to generate labels like data.frame does
 > : "V1 V2 V3...".
 > I'm trying to generate a N vector with label such as "Lab1 Lab2 ... LabN".
 > 
 > I guess this is pretty easy when you know R ;)
 > 
 > Thanks for help
 > 
 > Eric
 > 
 > ______________________________________________
 > R-help at stat.math.ethz.ch mailing list
 > https://stat.ethz.ch/mailman/listinfo/r-help
 > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list