Hi,
You can use the apply group of functions
n<-5
k<-4
unlist(lapply(1:n,rep, each=k)) # For vector output:
sapply(1:n,rep, each=k) # For a matrix output
Hope this helps
Souvik
On Sun, Apr 19, 2015 at 7:14 PM, John Sorkin
wrote:
> Windows 7 64-bit
> R 3.1.3
> RStudio 0.98.1103
>
>
> I am tryi
index where the values are repeated i.e (1,2,3,4,5). I have been able to
isolate out the values that are repeated from the unique list of characters
in x (i.e. y<-c("a","b")). One method can be to use a loop on the which
function but that would be too time consuming. Any hint
2 matches
Mail list logo