Viral,
This should work, yet get a vector of texts
a<-1:150
b<-ifelse(a<100,ifelse(a<10,"00","0"),"")
paste(b,a,sep="")
Best regards,
Joseph
Joseph Poj Gavinlertvatana
Doctoral student, Marketing
Harvard Business School
Wyss Hall, Soldiers Field, Boston, MA 02163
Ph 617.230.5907
Fx 617.496.4397
Txt/Vm 617.910.0563
Em pgavinlertvatana at
hbs.edu
From: gov2001-l-bounces at
lists.fas.harvard.edu [mailto:gov2001-l-bounces at
lists.fas.harvard.edu] On Behalf Of Viral Gandhi
Sent: Monday, May 10, 2010 9:20 AM
To: Class List for Gov 2001/E-2001
Subject: [gov2001] 3 digit numbers
Hi guys,
Does anyone know how to make R write a list like this:
001 002 003 ... 099 100 101 102
i.e. make all the numbers in the sequence have 3 digits.
Thanks,
Viral