[英]R Generating random hex color
How can I generate a random hex color with R? 如何用R生成随机的十六进制颜色? I want to create a function that will spit out strings in this format:
我想创建一个将以这种格式吐出字符串的函数:
# "255 0 0"
# "245 32 456"
# ...
Would I need to create a function that uses the sample function three times? 我是否需要创建一个使用样本函数三次的函数? or is there a simpler way to accomplish this in R?
还是有一种更简单的方法来在R中完成此操作? Thank you.
谢谢。
How about 怎么样
paste(sample(0:255,size=3,replace=TRUE),collapse=" ")
? ?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.