cannot allocate vector of ---- Size

0

Hi i am getting an error on the below code of cannot allocate a vector of size i have tried below the steps to get rid of the error but noting worked can some suggest how to fix the error for this script . Currently running on windows 10 64 bit session

#memory.limit()
#memory.size(8701)
#gc()
#Sys.setenv('R_MAX_VSIZE'=32000000000)
#library(cachem)
#install.packages("devtools", dependencies = TRUE)
#devtools::install_github("krlmlr/ulimit")
#ulimit::memory_limit(2000)

How can i recode this one so that i don't get the error message

ricuniv <- c(as.vector(DIV$RIC),as.vector(cap$QUOTATION_IDENT_RIC))
ricuniv <- unique(ricuniv)

nfi_uni_file1  <-  merge(as.data.frame(ricuniv),nfi_uni_file,by.x="ricuniv",by.y="6",all.x = T)
nfi_uni_file1  <-  nfi_uni_file1[unique(nfi_uni_file1$ricuniv),]

i  <-  1
adjcls_file <- c()
pd <- c()
ex <- c()
cpd <- c()
cex <- c()
cumx <- c()
AD <- c()
YLD <- c()
PE <- c()
EPS <- c()
repeat
  {
    adjcls_file[i] <- NA
    pd[i] <- NA
    ex[i] <- NA
    cumx[i] <- NA
    cpd[i] <- NA
    cex[i] <- NA
    AD[i] <- NA
    YLD[i] <- NA
    i1 <- 7
    PE[i] <- NA
    EPS[i] <- NA
    repeat
    {
      
    if(is.na(nfi_uni_file1[i,i1]) == FALSE)
      {
     if(nfi_uni_file1[i,i1] == 10517)
     {
       adjcls_file[i] <- nfi_uni_file1[i,i1+1]
     }
      if(nfi_uni_file1[i,i1] == 10529)
      {
        pd[i] <- nfi_uni_file1[i,i1+1]
      }
      if(nfi_uni_file1[i,i1] == 10530)
      {
        ex[i] <- nfi_uni_file1[i,i1+1]
      }
      if(nfi_uni_file1[i,i1] == 10531)
      {
        cumx[i] <- nfi_uni_file1[i,i1+1]
      }
      if(nfi_uni_file1[i,i1] == 10538)
      {
        cpd[i] <- nfi_uni_file1[i,i1+1]
      }
      if(nfi_uni_file1[i,i1] == 10539)
      {
        cex[i] <- nfi_uni_file1[i,i1+1]
      }
      if(nfi_uni_file1[i,i1] == 10534)
      {
        AD[i] <- nfi_uni_file1[i,i1+1]
      }
      if(nfi_uni_file1[i,i1] == 10535)
      {
        YLD[i] <- nfi_uni_file1[i,i1+1]
      }
      if(nfi_uni_file1[i,i1] == 10533)
      {
        PE[i] <- nfi_uni_file1[i,i1+1]
      }
      if(nfi_uni_file1[i,i1] == 10532)
      {
        EPS[i] <- nfi_uni_file1[i,i1+1]
      }
      }
      i1 <- i1+2
      if(i1>ncol(nfi_uni_file1))
        {
          break
        }
      }
  i <- i+1
  if(i>nrow(nfi_uni_file1))
  {
    break
  }
}
nfifinal <- data.frame(nfi_uni_file1$ricuniv,ex,pd,adjcls_file,cumx,cpd,cex,AD,YLD,PE,EPS)
nfi_uni_file2 <- data.frame()
pd1 <- c()
ex1 <- c()
cpd1 <- c()
cex1 <- c()
cumx1 <- c()
if(nrow(nfi_full_uni_file)>1)
{
nfi_uni_file2 <- merge(as.data.frame(ricuniv),nfi_full_uni_file,by.x="ricuniv",by.y="6",all.x = T)
nfi_uni_file2 <- nfi_uni_file2[unique(nfi_uni_file2$ricuniv),]
i <- 1
repeat
{
  pd1[i] <- NA
  ex1[i] <- NA
  cpd1[i] <- NA
  cex1[i] <- NA
  cumx[i] <- NA
  cumx1[i] <- NA
  i1 <- 7
  repeat
  {
    
    if(is.na(nfi_uni_file2[i,i1]) == FALSE)
    {
      if(nfi_uni_file2[i,i1] == 10529)
      {
        pd1[i] <- nfi_uni_file2[i,i1+1]
      }
      if(nfi_uni_file2[i,i1] == 10530)
      {
        ex1[i] <- nfi_uni_file2[i,i1+1]
      }
      if(nfi_uni_file2[i,i1] == 10538)
      {
        cex1[i] <- nfi_uni_file2[i,i1+1]
      }
      if(nfi_uni_file2[i,i1] == 10539)
      {
        cpd1[i] <- nfi_uni_file2[i,i1+1]
      }
      if(nfi_uni_file2[i,i1] == 10531)
      {
        cumx1[i] <- nfi_uni_file2[i,i1+1]
      }
    }
    i1 <- i1+2
    if(i1>ncol(nfi_uni_file2))
    {
      break
    }
  }
  i <- i+1
  if(i>nrow(nfi_uni_file2))
  {
    break
  }
}
}
nfifinal1 <- data.frame(nfi_uni_file2$ricuniv,ex1,pd1,cex1,cpd1,cumx1)
if(nrow(nfifinal1)>1)
{  
nfifinal <- merge(nfifinal,nfifinal1,by.x = "nfi_uni_file1.ricuniv",by.y ="nfi_uni_file2.ricuniv",all.x = T )
}
if(nrow(nfifinal1) == 0){
  nfifinal$ex1 <- NA
  nfifinal$pd1 <- NA
  nfifinal$cpd1 <- NA
  nfifinal$cex1 <- NA
  nfifinal$cumx1 <- NA
}

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.