r - Get the length of the list stored in a column of data.frame -


I am storing a list of stars in one column of my data.frame and I want to get the length of those lists. / P>

  & gt; Class (DF ['4', 'generated']) [1] "list" & gt; Summary (DF ['4', 'generated']) Length class mode 4 180 -non-character & gt;  [df ['4', 'generated']) [1] 1  

As shown above The "list" class, but shows the length (DF ['4', 'generated']) 180 instead of the expected result.

How do I get the actual list length, please?

UPD: I create data frames from JSON in this way:

  data & lt; - fromJSON ("out.json") matrix & lt; - cbind (id = name), t (rbdID (sapply (data, "c"))) df & lt; - Data.fr (matrix)  

And the data looks something like this:

  {"4": {"generated: [00A1CD093DB15425310C2BB57CB88BA460C87E5B26BAB3867D26870914E80603", " 018BE455F4A178A33517E3586AF115C9DF7356895B9A7416AD8D20D660B0866D "," 04C5893516CE5C3A6ADC907EC1484DE7542189E9AC7F138EE57DF088EF2F9D92 ", ,  

Try:

  Length (df ['4', 'generated'] [[1]])  

And if that "every list in the gene" Works for "(", generated ", drop = F)," [[, 1), length)


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

lua - HowTo create a fuel bar -