I have an R script where
l2
is an array of all permutations of three letter combinations a-z ie the first values is aaa
and the last values is zzz
c <- rpois(n, 5)
is a vector of poisson distribution results.
I want to create a data frame that containtns a random number of samples from l2
and concatenates them into a path like this: abc -> vye -> tyb
for 3.
df_p <- data.frame('len' = c, 's1' = paste(sample(l2,c), collapse = ' -> '))
I've tried to use the above row to create it, but it returns the same path for every row. The length of this path corresponds to the first value in c.
No comments:
Post a Comment