Displaying 1 result from an estimated 1 matches for "dnanucleotides".
2012 Oct 21
1
Changing a for loop to a function using sapply
...###############
# The following lines create a string of nucleotides and uses a for loop
to create multiple strings.
# random.string replicate something based on rs sampling criteria.
random.string <- rep(NA, rs<-sample(3:18,1,replace = TRUE))
# The randomizeString function uses members of DNAnucleotides list to
sample 3 at a time
# placing the results in "a".
randomizeString <- function(x) {
DNAnucleotides<- c("a","c","g","t")
a <-sample(DNAnucleotides,3, replace = TRUE)
return(a)
}
# The following paste output uses...