On Dec 20, 2009, at 3:50 PM, rusers.sh wrote:
Hi,
Anybody can give me some hints on the following problem?
s<-c(1101111,112321)
I want to insert a dot "." after the third number and get the
following
results.
110.1111
112.321
Thanks a lot.
s <- c(1101111, 112321)
> s / (10 ^ (nchar(s) - 3))
[1] 110.1111 112.3210
See ?nchar
> nchar(s)
[1] 7 6
HTH,
Marc Schwartz
______________________________________________
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.