Hi guys, I want to realize this function
for vector A = { 1 2 3 4 }
vector B = { 1 2 2 3}
I want element in A to replicate corresponding times in B. The result should be
{1 2 2 3 3 4 4 4} as such. I know in R there is " rep" which can do this. Is there any replicate function in Gauss? I search the keywords but couldnt find any. Thanks in advance!
3 Answers
0
By the way, I know that naive way of it, I can do a loop to iterate and assign values, just wondering whether in Gauss there is native efficient way to do this.
0
There is no GAUSS function designed particularly for that purpose. I might be able to come up with a clever way to do it. Is it something that ends up taking a lot of time, because the dataset is very large, or it is called many times? Or do you just want something more elegant to call in your code?
0
Not taking much time actually, just curious whether there are any " Rep" keyword I dont know. Thanks anyway~ For now, I did it by a loop.
Your Answer
3 Answers
By the way, I know that naive way of it, I can do a loop to iterate and assign values, just wondering whether in Gauss there is native efficient way to do this.
There is no GAUSS function designed particularly for that purpose. I might be able to come up with a clever way to do it. Is it something that ends up taking a lot of time, because the dataset is very large, or it is called many times? Or do you just want something more elegant to call in your code?
Not taking much time actually, just curious whether there are any " Rep" keyword I dont know. Thanks anyway~ For now, I did it by a loop.