KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm fairly new to R, but I've done a lot of searching and haven't found an answer to my question. I have a vector with many repetitions of 8 digits: allNum <- c(rep(1, 70), rep(2, 70), rep(3, 35), rep(4, 35), rep(5, 70), rep(6, 70), rep(7, 35), rep(8, 35)) Now I want to take a permutation of this (presumably using sample(allNum, 420, replace=FALSE) ), but I do not want any consecutive identical digits -- for example: 1 2 2 8 Is there a simple way to do this?
Tags (comma-separated)
Save Edits
Cancel