0

I have a large dataset I am reading in R I want to apply the Unique() function on it so I can work with it better, but when I try to do so, I get this prompted:

clients <- unique(clients)
Error: cannot allocate vector of size 27.9 Mb

So I am trying to apply this function part by part by doing this:

clientsmd<-data.frame()
n<-7316738  #Amount of observations in the dataset
t<-0
for(i in 1:200){
  clientsm<-clients[1+(t*round((n/200))):(t+1)*round((n/200)),]
  clientsm<-unique(clientsm)
  clientsmd<-rbind(clientsm)
  t<-(t+1) }

But I get this:

 Error in `[.default`(xj, i) : subscript too large for 32-bit R
Community
  • 1
  • 1
Gotey
  • 449
  • 4
  • 15
  • 41
  • 2
    Related: http://stackoverflow.com/questions/1875795/best-practices-for-storing-and-using-data-frames-too-large-for-memory – effel Mar 07 '16 at 14:18
  • 2
    Also: [R memory management / cannot allocate vector of size n Mb](http://stackoverflow.com/questions/5171593/r-memory-management-cannot-allocate-vector-of-size-n-mb) – Pierre L Mar 07 '16 at 14:23
  • How can I use one of this packages to achieve what I'm trying to do? – Gotey Mar 07 '16 at 14:57
  • For example I do this:ok<-as.ffdf(clients) Error: cannot allocate vector of size 27.9 Mb | and for the package "bigmemory" it changues my char variables to numbers – Gotey Mar 07 '16 at 15:06

0 Answers0