| To: | s-news@lists.biostat.wustl.edu |
|---|---|
| Subject: | Re: edit values |
| From: | Mario Cortina Borja <M.Cortina@ich.ucl.ac.uk> |
| Date: | Thu, 18 Aug 2005 14:38:48 +0100 |
| In-reply-to: | <BAY105-F298553B1A5AEC5DFA3719AB6B20@phx.gbl> |
|
At 01:09 PM 8/18/2005 +0000, Jose Bartolomei wrote: > Dear S-Plus users, > > I have a character column within a data set that has values with 7 and 8 characters of length. > > Which is your recommended way to add a 0at the left of those values with 7 characters only? > > > Thanks in advance, > Jose > Research degree student > London School Hygiene & Tropical Medicine (LSHTM) Try test<- c('1234567', '12345678') test<- ifelse(nchar(test)==8, test, paste('0',test,sep='')) Best wishes, Mario Dr Mario Cortina Borja Senior Lecturer in Statistics M.Cortina@ich.ucl.ac.uk Phone +44(0)20 7905 2113 Fax +44(0)20 7905 2381 Paed. Epid. & Biostats, Institute of Child Health, UCL, London WC1N 1EH, UK |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | edit values, jose Bartolomei |
|---|---|
| Next by Date: | Re: edit values, Chalvatzis, Dimitrios (Energy Wholesale) |
| Previous by Thread: | edit values, jose Bartolomei |
| Next by Thread: | Re: edit values, Chalvatzis, Dimitrios (Energy Wholesale) |
| Indexes: | [Date] [Thread] [Top] [All Lists] |