[R] re moving intial numerals

baptiste auguie baptiste.auguie at googlemail.com
Sat Aug 1 12:33:09 CEST 2009


Try this,

formatC(d %% 1e5, width=5, flag = "0", mode="integer")

 [1] "00735" "02019" "04131" "04217" "04629" "04822" "10115" "11605" "14477"
[10] "15314" "15438" "19040" "19603" "22735" "22853" "23415" "24227" "24423"


HTH,

baptiste


2009/7/31 PDXRugger <J_R_36 at hotmail.com>:
>
>
> I would like to recreate "data" so that only the last 5 digits of the below
> data are inlcuded as data so 2005000002019 would become 02019.  Any ideas.
>
> data=c(2005000000735,
> 2005000002019,
> 2005000004131,
> 2005000004217,
> 2005000004629,
> 2005000004822,
> 2005000010115,
> 2005000011605,
> 2005000014477,
> 2005000015314,
> 2005000015438,
> 2005000019040,
> 2005000019603,
> 2005000022735,
> 2005000022853,
> 2005000023415,
> 2005000024227,
> 2005000024423)
>
> --
> View this message in context: http://www.nabble.com/removing-intial-numerals-tp24763596p24763596.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.
>



-- 
_____________________________

Baptiste Auguié

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

http://newton.ex.ac.uk/research/emag




More information about the R-help mailing list