# ].data.frame instead of ].data.table

#### azalea

##### New Member
Is there a was to run ].data.frame instead of ].data.table when using package data.table? I ask because I get error "Error: cannot allocate vector of size 1.1 Mb" when running the below line of code on very large data and using ].data.table:
dat2 = rowsum(dat[,cols,with=F], dat$id) ...but know that the equivalent code with ].data.frame doesn't get errors: dat2 = rowsum(dat[,cols_n], dat$id)

Note: I really only read in the data.table package because I'm using it's handy fread function.

#### Dason

##### Ambassador to the humans
Why not just convert your data to a data.frame using as.data.frame.

#### azalea

##### New Member
I have tried both:
dat2 = rowsum(as.data.frame(dat[,cols,with=F]), dat$id) and: dat2 = as.data.frame(rowsum(dat[,cols,with=F], dat$id))
and I'm still getting the same error, I think because it's still using ].data.table instead of ].data.frame.

#### Dason

##### Ambassador to the humans
Do as.data.frame(dat)[your data.frame indexing here]

Or probably more appropriate
Code:
dat <- as.data.frame(dat)
then do your indexing on dat.

#### azalea

##### New Member
Hmm, it looks like the class of my dat object is both data.table and data.frame. When I try to run dat = as.data.frame(dat), I get error "Error: cannot allocate vector of size 31.5 Mb". For now as a solution I'll just avoid reading in the data.table package until after I run this code.