I have a large table with unique characteristics that occur on multiple IDs (table A). Is there a clever workaround in which I could horizontally consolidate the values so that in the second table B I have unique IDs in the rows and in the columns occurring characteristics (which also occur in different numbers per ID)? The fields for missing features in an ID row I want to fill with NA. Since I have a maximum of 22 unique characteristics per ID, the maximum number of columns should be 23 (with ID).
With the loop it works, but it takes forever.
I tried all solutions from How to reshape data from long to wide format without success.
E.g., for reshape
, cast
, dcast
, and other functions the vector
is too large giving:
Error: cannot allocate vector of size ...