thanks guys!
I also found this solution but I think yours is better.
as.vector(rbind(c(1, 5, 23)))
Cheers
syrvn
--
View this message in context:
http://r.789695.n4.nabble.com/Duplicate-elements-of-a-vector-tp3879561p3879907.html
Sent from the R help mailing list archive at Nabble.com.
__
Check function rep(), e.g.,
rep(c(1, 5, 23), each = 2)
I hope it helps.
Best,
Dimitris
On 10/6/2011 8:58 PM, syrvn wrote:
Hi,
let's assume I have the following vector a:
1 5 23
How can I use R to duplicate the elements so that my new vector looks like:
1 1 5 5 23 23
Many thanks,
Syrv
rep(c(1,5,23), each=2)
On Thu, Oct 6, 2011 at 2:58 PM, syrvn wrote:
> Hi,
>
> let's assume I have the following vector a:
>
> 1 5 23
>
> How can I use R to duplicate the elements so that my new vector looks like:
>
> 1 1 5 5 23 23
>
>
> Many thanks,
> Syrvn
>
> --
> View this message in context:
Hi,
let's assume I have the following vector a:
1 5 23
How can I use R to duplicate the elements so that my new vector looks like:
1 1 5 5 23 23
Many thanks,
Syrvn
--
View this message in context:
http://r.789695.n4.nabble.com/Duplicate-elements-of-a-vector-tp3879561p3879561.html
Sent from
4 matches
Mail list logo