Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to solve this error : attempt to make a table with >= 2^31 elements?

I have a data (dt) as below (it is just a simplified example, so you can understand my request):

col 1 col 2 col 3
A cell 1 1,2
B cell 2 3,5,6
A cell 3 1,2
D cell 4 9,7,8

What I want to know is in how many cells I can have the same combinations of col1 and col3 :

So the output should be like this :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

col 1 col 3 col 2
A 1,2 2 cells
B 3,5,6 1 cell
D 9,7,8 1 cell

I was trying this command using "data.table" in r :

data.table(table(dt$col1,dt$col3))

However it gives me this error :

error in table(dt$col1,dt$col3) : attempt to make a table with >= 2^31 elements

I am doing this in R, data.table

>Solution :

Try this

library(dplyr)

df %>% group_by(col1 , col3) %>% summarise("coll2" = paste(length(col3) , "cells"))
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading