Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/65.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/17.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,我写了这样一个循环: n<-3 for(i in 1:n-1) { print(c("i= ")) print(c(i)) } n在for循环中添加括号:1:(n-1)。如果没有括号,则取1:n=1,2,3,然后从每个括号中减去1 您可能还需要打印(粘贴(“i=,i))在for循环中添加括号:1:(n-1)。如果没有括号,则取1:n=1,2,3,然后从每个括号中减去1 您可能还需要打印(粘贴(“i=,i))

我写了这样一个循环:

n<-3
for(i in 1:n-1)
{
print(c("i= "))
print(c(i))
}

n在for循环中添加括号:
1:(n-1)
。如果没有括号,则取
1:n
=1,2,3,然后从每个括号中减去1


您可能还需要打印(粘贴(“i=,i))
在for循环中添加括号:
1:(n-1)
。如果没有括号,则取
1:n
=1,2,3,然后从每个括号中减去1

您可能还需要
打印(粘贴(“i=,i))