I would like to know how to collapse a data with two ID variables. For some variables, I wanted the first value and for some variables I wanted the last variable. This is a data frame contains around 25 variables and around 600 thousand observations with 64 repetitions. After collapse, depending on the ID variables the data may get reduced to below 200 thousand observations.
what is your criteria for this ?
Heres a simple example on iris dataset which has 50 records for each Species, and 4 measurements at each record. for records related to length I take the last record, for width I take the first.
I was able to get the first and last values for the required variables. Similar to the first and last values. How to get the count of a variable in the similar way.