[R] Create a numeric series in an efficient way
Bert Gunter
bgunter@4567 @end|ng |rom gm@||@com
Fri Jun 14 03:13:00 CEST 2024
Nope. She would have wanted the 'each' argument = 84. See ?rep.
-- Bert
On Thu, Jun 13, 2024 at 3:54 PM Ebert,Timothy Aaron <tebert using ufl.edu> wrote:
> Maybe this was your solution?
>
> blocC <- c(rep(x=c(1:13), times=84))
> blocC <- arrange(.data = data.frame(blocC), blocC)
>
> The second line sorts, but that may not be needed depending on
> application. The object class is also different in the sorted solution.
>
> Tim
> -----Original Message-----
> From: R-help <r-help-bounces using r-project.org> On Behalf Of Francesca
> PANCOTTO via R-help
> Sent: Thursday, June 13, 2024 2:22 PM
> To: r-help using r-project.org
> Subject: Re: [R] Create a numeric series in an efficient way
>
> [External Email]
>
> I apologize, I solved the problem, sorry for that.
> f.
>
>
>
> Il giorno gio 13 giu 2024 alle ore 16:42 Francesca PANCOTTO <
> francesca.pancotto using unimore.it> ha scritto:
>
> > Dear Contributors
> > I am trying to create a numeric series with repeated numbers, not
> > difficult task, but I do not seem to find an efficient way.
> >
> > This is my solution
> >
> > blocB <- c(rep(x = 1, times = 84), rep(x = 2, times = 84), rep(x = 3,
> > times = 84), rep(x = 4, times = 84), rep(x = 5, times = 84), rep(x =
> > 6, times = 84), rep(x = 7, times = 84), rep(x = 8, times = 84), rep(x
> > = 9, times = 84), rep(x = 10, times = 84), rep(x = 11, times = 84),
> > rep(x = 12, times = 84), rep(x = 13, times = 84))
> >
> > which works but it is super silly and I need to create different
> > variables similar to this, changing the value of the repetition, 84 in
> this case.
> > Thanks for any help.
> >
> >
> > F.
> >
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using 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.
>
> ______________________________________________
> R-help using 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.
>
[[alternative HTML version deleted]]
More information about the R-help
mailing list