I suggest you to use the dplyr
package. You can try the following code: if df is your dataframe:
library(dplyr)
summarised_df <- group_by(df, Ticker) %>%
summarise(
max(tradeDate),
sum(SharesBought),
max(HighestPxPaid),
min(LowestPxPaid)
)
3
solved How to summarise a dataframe in R with different function for different column?