I have a question regarding my data analysis. Specifically, I have calculated about 100 correlations and would like to see the top 10 correlation values from these 100 calculated correlations. Unfortunately, I'm a bit stuck right now and can't get any further. Can you help me how to output these top 10 correlation values automatically without checking them manually one by one?
The correlation values are calculated like this:
my_correlation_1 <- function(ticker_subset, data) {
cor(subset(data, TickerSymbol == ticker_subset, c(Sales, Stockprice_quarterly)))
}
mycor1 <- lapply(unique(dat$TickerSymbol), my_correlation_1, data = dat)
names(mycor1) <- unique(dat$TickerSymbol)
The correlation calculations provide results like this:
# $AMD
# Sales Stockprice_quarterly
# Sales 1.0000000 -0.2261417
# Stockprice_quarterly -0.2261417 1.0000000
#
# $AAPL
# Sales Stockprice_quarterly
# Sales 1.0000000 0.6531391
# Stockprice_quarterly 0.6531391 1.0000000
#
# $EBAY
# Sales Stockprice_quarterly
# Sales 1.0000000 0.2032839
# Stockprice_quarterly 0.2032839 1.0000000
Many thanks in advance!