just using as.character does not add the leading/trailing zeros: > Vect <- c(12.234, 234.5675, 1.5) > as.character(Vect) [1] "12.234" "234.5675" "1.5" >
On Sun, Feb 13, 2011 at 12:04 PM, Sascha Vieweg <saschav...@gmail.com> wrote: > On 11-02-13 10:48, David Winsemius wrote: > >> On Feb 13, 2011, at 10:43 AM, Bogaso Christofer wrote: >> >>> Hi there, I have a numeric vector let say: >>> >>> Vect <- c(12.234, 234.5675, 1.5) >>> >>> Now I want a string vector like: >>> >>> changedVec <- c("012.234", "234.568", "001.500") >>> >> >> ?sprintf > > Just for my own understanding: Why not > > as.character(Vect) > > ? > > > -- > Sascha Vieweg, saschav...@gmail.com > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Jim Holtman Data Munger Guru What is the problem that you are trying to solve? ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.