[R] Number with fixed digit length - zero fill-up

Jägermeyr, Jonas jonas.jaegermeyr at geo.hu-berlin.de
Mon Feb 1 09:00:42 CET 2010


Dear R-help members,

I'm quite new to R and I apologize for my basic question, but I haven't
been able to find a solution yet.

I try to interpret vector entries as a binary code, but unfortunately
every first digit which is zero disappears.

So how can I set any number (e.g. x = 10110) to a 8-digit zero fill-up (x
= 00010110) in order to address digit indices?

Or other way round, how can I make the 'substr' function to count from the
right hand side?

Thank you.

With kind regards,

Jonas Jägermeyr


Department of Geography
Humboldt-University of Berlin
jonas.jaegermeyr at geo.hu-berlin.de



More information about the R-help mailing list