library('dplyr')
<- read.csv('https://raw.githubusercontent.com/Brent-Morrison/Misc_scripts/master/stock_data.csv') df_raw
# Select columns and date required
<- df_raw %>%
df filter(date_stamp == '30/06/2021') %>%
select(symbol, date_stamp, sector, asset_growth, roa, roe, leverage, ttm_earnings)
# Filter for top 5
<- df %>% group_by(sector) %>% slice_max(order_by = ttm_earnings, n = 5) df
# Print table
::paged_table(df) rmarkdown