title: What does the "Unexpected end of input" error mean?
body: <p>I am currently building an application in R to calculate the QR matrix decomposition, the QR non negative matrix decomposition and computing ICA. At the moment I am working on the first task. I am getting the following error:</p>
  
  <pre><code>source("trial.R")
  
  Error in source("trial.R") : trial.R:153:0: unexpected end of input
  151: 
  152: 
      ^
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>library(rworldmap)
  
  
  install.packages("plotrix")
  library(plotrix)
  
  
  install.packages("fastICA")
  library(fastICA)
  install.packages("Matrix")
  source("utils.R")
  library("corpcor")
  
  twophase.cx &lt;- function(A, k, fudge=5) {
  
      SVD=svd(normalised)
      V=SVD$v
  
      vk&lt;-array(0,dim=c(nrow(V),k))
      cols_v=ncol(V)
      for(cl in 1:k){
       for(r in 1:nrow(V)){
        vk[r,cl]&lt;-V[r,cl+k]
        }}
  
     probs=rep(0,k)
  
     prod=A%*%vk%*%t(vk)
      for(j in 1:k){
  
      subA=A[nrow(A)-j,ncol(A)-j]
  
      subV=vk[nrow(subV)-j,ncol(vk)-j]
  
      subprod=prod[nrow(prod)-j,ncol(prod)-j]
  
      normv&lt;-norm(subV,"2")
      normA&lt;-norm(subA,"2")
      normProd&lt;-norm(subprod,"2")
      add1&lt;-(normv*normv)/(2*k)
      add2&lt;-((normA*normA)-(normProd*normProd))/(2*((normA*normA)-           (normProd*normProd)))                                          
      probs[j]&lt;-add1+add2
    }
  
     const&lt;-(k*log(k))
  
     keep&lt;-sample(c(1:k),size=const,prob=probs,replace=FALSE)
  
     S1&lt;-matrix(0,ncol(A),const)
     for(i in 1:ncol(A)){
      for(j in 1:const){
       if(is.element(j,keep)){
        S1[i,j]&lt;-1}}}
  
    D1&lt;-matrix(0,const,const)
   for(i in 1:const){
     if(is.element(i,keep)){
      prd&lt;-const*probs[i]
     if(prd&lt;1){D[i,i]&lt;-prd}
     if(prd&gt;=1){D[i,i]&lt;-1}
    }
  
   toSample&lt;-t(vk)%*%S1%*%D1
   S2&lt;-qr(toSample)$pivot[1:k]
   C&lt;-A %*% S1 %*% S2
  cols&lt;-C
  X&lt;-pseudoinverse(C)%*%A
  err&lt;-norm(A-C %*% X, 'F')
  list(cols=C,X=X,  err=err)    
  
  } 
  
  
  cx &lt;- function(A, k, nreps=20, ...) {
  best.res = list(cols=NA, X=NA, err=Inf)
  for (rep in 1:nreps) {
      res &lt;- twophase.cx(A, k, ...)
      if (res$err &lt; best.res$err) {
          best.res &lt;- res
      }
  }
  best.res
  }
  
  
  data &lt;- as.matrix( read.csv("worldclim.csv") )
  coord &lt;- read.csv("coordinates.csv")
  
  
  
  data.normal &lt;-scale(data,center=TRUE,scale=TRUE)
  k&lt;-10
  
  
  cx.res &lt;- cx(t(data.normal), 5)
  
  
  xLim &lt;- c(min(coord["lon"]), max(coord["lon"]))
  yLim &lt;- c(min(coord["lat"]), max(coord["lat"]))
  map &lt;- getMap(resolution="low")
  plot(map, xlim=xLim, ylim=yLim, asp=1)
  
  
  
  points(coord[cx.res$cols,1], coord[cx.res$cols,2], col=2, pch=19, cex=1.5)
  points(coord[cx.res$cols,1], coord[cx.res$cols,2], col=4, pch=65:127,    cex=.6)
  
  x &lt;- cx.res$X[1,]
  plot(map, xlim=xLim, ylim=yLim, asp=1)
  points(coord[,1], coord[,2], col=color.scale(x, c(0,1), 0.8, 1,     color.spec="hsv"), cex=.6, pch=19)
  color.legend(xLim[1]+1, yLim[1]-5, xLim[2]-1, yLim[1]-3, c(round(min(x),    4), round(mean(x), 4), round(max(x), 4)), color.scale(sort(x), c(0,1), 0.8, 1,    color.spec="hsv"), gradient="x")
  
  
  convex.cone &lt;- function(A, k) {
  
  }
  
  
  house.price &lt;- read.csv("us_housing_prices.csv", row.names=1)
  
  
  rownames(house.price)
  
  colnames(house.price)[1:18]
  colnames(house.price)[seq(1, by=12, to=ncol(house.price))]
  
  
  plot.time.series(house.price[1:5,])
  plot.time.series(house.price[6:10,])
  plot.time.series(house.price[11:15,])
  plot.time.series(house.price[16:20,])
  
  hp &lt;- house.price
  hp[is.na(house.price)] &lt;- 0
  
  
  hp &lt;- scale(t(hp))
  
  hp.ica &lt;- fastICA(hp, 20, fun="logcosh", verbose=TRUE)
  
  
  
  
  rownames(hp.ica$S) &lt;- colnames(house.price)
  with(hp.ica, plot.time.series(t(S[,1:5])) )
  
  with(hp.ica, plot(S[,1:2], asp=1) )
  
  with(hp.ica, identify(S[,1:2], labels=rownames(S)) )
  </code></pre>
  
  <p>I am quite new to R. Please suggest which might be the issue.</p>