On 8 September 2017 at 14:37, peter dalgaard <pda...@gmail.com> wrote:
>
>
> > On 8 Sep 2017, at 14:03 , peter dalgaard <pda...@gmail.com> wrote:
> >
> > x <- scan("~/Downloads/digits.txt")
> > x <- x[-seq(1,220000,11)]
>
> ...and, come to think of it, if you really want the 1000000 random digits:
>
> xx <- c(outer(x,10^(0:4), "%/%")) %% 10
>

Hi Peter,
  Thanks a lot for the answers. I can see that I need to read about outer().
  However I get a different result than expected.

R> x <- scan("digits.txt")
Read 220000 items

R> head(x)
[1]     0 10097 32533 76520 13586 34673

R> x <- x[-seq(1,220000,11)]
R> head(x)
[1] 10097 32533 76520 13586 34673 54876

R> head(c(outer(x,10^(0:4), "%/%")) %% 10, 10) #
[1] 7 3 0 6 3 6  9 7 2 5

Regards
Martin

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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