Say I have a dataframe
source <- data.frame(ID=c(1,2), COUNT=c(3,4))
that looks like this:
ID COUNT
1 1 3
2 2 4
I’d like to transform this into a dataframe that has COUNT records for each ID, with a new unique ITEMID, like this
ITEMID SOURCEID
1 1 1
2 2 1
3 3 1
4 4 2
5 5 2
6 6 2
7 7 2
I can do it with a for loop, but am looking to learn how to do this with apply type functions
No need for
applyfunctions: