R在循环中创建变量时显示错误消息
我用Tinn-R编写了我的程序。当我使用source()在R中运行它时,显示了一条错误消息。以下示例仅包括部分循环R在循环中创建变量时显示错误消息,r,loops,R,Loops,我用Tinn-R编写了我的程序。当我使用source()在R中运行它时,显示了一条错误消息。以下示例仅包括部分循环 for (nn in 1:length(nSim)) ##whether the right loop??? { r.all <- c() p.final <- array(0, c(15,5)) #1-5 a, b1, b2, b3, b4; 6 group i
for (nn in 1:length(nSim)) ##whether the right loop???
{
r.all <- c()
p.final <- array(0, c(15,5)) #1-5 a, b1, b2, b3, b4; 6 group id
r.reference <- cbind(GRM_sim(t(p.sample[,1]), t(p.sample[,2:5]),sample.all[iS],0,rep(1,sample.all[iS]))
DIF_ID <-c()
DIF_index <- rep(0,15)
for (iC in 1:length(CDIF))
{
if (CDIF[iC]==1)
{
DIF_ID <- sample(1:15,DIF.all[iDIF.all]) ##consistent DIF
}
for (id in 1:length(DIF_ID))
{
DIF_index[DIF_ID[id]] <-1
}
...
for(nn in 1:length(nSim))35;#循环是否正确???
{
r、 所有该错误都是缺少paren的典型错误。请自己找一个匹配paren的编辑器,或者学习更自由地使用空格和回车符。此网页末尾滚动的第五行缺少结束paren:
r.reference <- cbind(GRM_sim( t( p.sample[,1] ),
t( p.sample[,2:5]),
sample.all[iS],0,
rep(1, sample.all[iS])
)
^
missing paren here
r.reference此错误是缺少括号的典型错误。请自己找一个与括号匹配的编辑器,或者学习更自由地使用空格和回车符。此网页末尾滚动的第五行缺少结束括号:
r.reference <- cbind(GRM_sim( t( p.sample[,1] ),
t( p.sample[,2:5]),
sample.all[iS],0,
rep(1, sample.all[iS])
)
^
missing paren here
r.reference