rstudio – Exploring a way in R Studio version 4.3.2 to create a rmd file that analyzes 10Q reports and extracts key components to create investment memos

I am a new user to R Studio and have the basics down but definitely not an expert. Have used multiple AI sources to test the waters on creating investment portfolios and investment ideas based on the graphs and charts R provides. I want to be able to have R take 10Q reports of specific companies and extract or isolate the key information to find the knowns and unknowns and strengths and weaknesses to be able to create some investment memos.

I have tried multiple AI sources in helping with this but it seems the versions and packages no longer align, along with some of the research I have done on this website, github, and others. I am no expert so it is not easy interpreting either.
Any information helps

install.packages("SEC-Edgar-Utilities")
install.packages("tm")
install.packages("Rseek")
install.packages("greport")

library(greport)
library(rseek)
library(SEC-Edgar-Utilities)
library(tm)
library(dplyr)
# Get available packages
p_matches <- available.packages(filters = NULL)

# Search package descriptions
search_terms <- "search terms"
p_matches_filtered <- p_matches[grep(search_terms, rownames(p_matches), ignore.case = TRUE), ]
tickers <- c("AAPL", "NVDA", "CMG", "PG", "HOOD", "GOOG")

filings <- lapply(tickers, get_10Q)
names(filings) <- tickers

income_statements <- lapply(filings, function(x) get_section(x, "income_statement"))
balance_sheets <- lapply(filings, function(x) get_section(x, "balance_sheet"))

notes <- lapply(filings, function(x) get_section(x, "notes"))

notes_corpus <- lapply(notes, function(x) {
  Corpus(VectorSource(x)) %>%
    tm_map(content_transformer(tolower)) %>%
    tm_map(removePunctuation) %>%
    tm_map(removeNumbers)
})
names(notes_corpus) <- tickers

term_freq <- lapply(notes_corpus, function(x) {
  TermDocumentMatrix(x) %>%
    as.matrix() %>%
    rowSums() %>%
    sort(decreasing = TRUE)
})
names(term_freq) <- tickers

lapply(term_freq, function(x) head(x, 10))

Read more here: Source link