Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我如何用R写下面的内容?_R - Fatal编程技术网

我如何用R写下面的内容?

我如何用R写下面的内容?,r,R,我试过使用rep等,但我只能得到一种颜色 使用rep和/或c,最多两次,每次最多两个参数 这是家庭作业吗?查看?rep…中的times参数试试c(rep('red',3),rep('green',2),rep('blue',1))不能使用rep 3次关于c(c(rep('red',3),rep('green',2)),“blue”)?是的!谢谢你,杰克 "red", "red", "red", "green", "green", "blue" rep(c("red", "green", "bl

我试过使用
rep
等,但我只能得到一种颜色

使用
rep
和/或
c
,最多两次,每次最多两个参数


这是家庭作业吗?查看
?rep
…中的
times
参数试试c(rep('red',3),rep('green',2),rep('blue',1))不能使用rep 3次关于c(c(rep('red',3),rep('green',2)),“blue”)?是的!谢谢你,杰克
"red", "red", "red", "green", "green", "blue"
rep(c("red", "green", "blue"), c(3, 2, 1))