no non-missing arguments to min on vector with text

Hey yall ill keep it short and simple.

im following along with this earnings call sentiment analysis.

I've had issues with packages but manage to pushed to down to cleaning.

I'm currently stuck. The funny part is it was working fine yesterday but I was having rjava/Qdap issues that I fixed. Now my code isn't working like it was yesterday

Warning message: In min(which(!str_detect(transcript_text, "[[:upper:]][\w]+ -"))) : no non-missing arguments to min; returning Inf

I repeat I did not have this issue yesterday before i fixed qdap/java. help please.

I checked that all the packages worked. Changed the vector value to see if it work and it does. checked that text was saved into transcript_text .

company_name <- "Advansix"
ticker <- "ASIX"

#Transcript URLs

Q4<-"AdvanSix's (ASIX) CEO Erin Kane on Q4 2021 Results - Earnings Call Transcript | Seeking Alpha"

##Reading the body of the html, and converting it to a readable text format

html1<- read_html(Q4)%>%
html_nodes("body")%>%
html_text()

transcript_text <- html1
transcript_text

#Seperating the text by new line characters in html code
transcript_text <- strsplit(transcript_text, "\n") %>% unlist()
transcript_text

#Remove empty lines
transcript_text <- transcript_text[!stri_isempty(transcript_text)]
#Getting the earnings date
transcript_text

#earnings_date <- html_text(html_nodes(transcript_text, "date")) %>% paste0(collapse = "")

#Create pattern to grab relevant names such as Analyst and Executives.
pattern1 <- capture(upper() %R% one_or_more(WRD) %R% SPC %R%
upper() %R% one_or_more(WRD)) %R% " - " %R% capture(one_or_more(WRD) %R%
optional(char_class("- ,")) %R% zero_or_more(WRD %R% SPC %R% WRD %R% "-" %R% WRD))

#Give the names all common seperators
transcript_text <- gsub("–","-",transcript_text)
transcript_text
regex pattern to search for the starting index containing executive names. Finds something
idx_e <- min(which(str_detect(transcript_text, "[[:upper:]][\w]+ -")))
idx_e

#Dropping everything before the start of Executive names, and resetting the index back to 1
transcript_text <- transcript_text[idx_e:length(transcript_text)]
transcript_text
idx_e <- 1
idx_e

#Repeating to find the starting index for the analyst names
idx_a <- min(which(!str_detect(transcript_text, "[[:upper:]][\w]+ -")))


In min(which(!str_detect(transcript_text, "[[:upper:]][\w]+ -"))) :
no non-missing arguments to min; returning Inf

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.