Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
12
Task/Pick-random-element/R/pick-random-element.r
Normal file
12
Task/Pick-random-element/R/pick-random-element.r
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# a vector (letters are builtin)
|
||||
letters
|
||||
# [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s"
|
||||
# [20] "t" "u" "v" "w" "x" "y" "z"
|
||||
|
||||
# picking one element
|
||||
sample(letters, 1)
|
||||
# [1] "n"
|
||||
|
||||
# picking some elements with repetition, and concatenating to get a word
|
||||
paste(sample(letters, 10, rep=T), collapse="")
|
||||
# [1] "episxgcgmt"
|
||||
Loading…
Add table
Add a link
Reference in a new issue