Hello R community,
I have the following data frame:
x <- tibble(
name = c("A", "B", "C"),
type = c("34;30;100;1;1;9;9;100;200;100;1;1","34;30;34","30;45;1;45;30;30")
)
How can I count the individual element (separated by ';') in the column 'type' so that I can know the total of each 'type' in the data frame?
For example, I'm looking to get a result like this:
type totals
<chr> <int>
'34' 3
'30' 5
'45' 2
'1' 5
'100' 3
'9' 2
'200' 1
I was wondering if there is any function(s) in R that makes this operation.
Many thanks in advance