Hi darkhorn,
Here are two suggestions:

# Suggestion 1
z <- 78923698701
foo <- function(x, pos) strsplit(as.character(x),"")[[1]][pos]
foo(z,2)
# [1] "8"

# Suggestion 2
foo2 <- function(x, pos) substr(x,pos,pos)
foo2(z,2)
# [1] "8"

See ?strsplit and ?substr for more details.

HTH,
Jorge

On Sat, Sep 12, 2009 at 6:16 PM, darkhorn <darkh...@gmail.com> wrote:

>
> I have a huge number such as 78923698701
> z<-78923698701
> I want to find the integer of a given location, for example here, what is
> the 2nd number? 8.
>
> Thanks in advance!
> --
> View this message in context:
> http://www.nabble.com/the-integer-of-a-given-location-tp25418729p25418729.html
> Sent from the R help mailing list archive at Nabble.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.
>

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to