R showed an error message when create a variable in a loop

I wrote my program in Tinn-R. When I ran it in R by using source(), an error message showed. The following example only includes partial loop.

          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
               }
              ...

Error in source("120413consistentMH.R") : 120413consistentMH.R:107:17: unexpected symbol 106: 107: DIF_ID

Thanks for your time.

Answers


The error is typical for a missing paren. Get yourself an editor that matches parens or learn to make more liberal use of spaces and carriage returns. The fifth line that scrolls off the end of this webpage is missing a closing 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

Need Your Help

WCF client unit test/integration test

wcf web-services soap wcf-client

I generated a proxy client to a SOAP web service. I would like to test the request envelop without actually calling the service at the other end (actual endpoint)

No JFrame Title after exporting to JAR

eclipse jar export frame title

When running the JAVA app in Eclipse, the JFrame title is displayed, but when running the exported JAR file, there is no title showing on the frame.