1

I have code below that calculates a frequency for each column element (respective to it's own column) and adds all five frequencies together in a column. The code works but is very slow and the majority of the processing time is spent on this process. Any ideas to accomplish the same goal but more efficiently?


Create_Freq <- function(Word_List) {

library(dplyr)

Word_List$AvgFreq <- (Word_List%>% add_count(FirstLet))[,"n"] + (Word_List%>% add_count(SecLet))[,"n"] + (Word_List%>% add_count(ThirdtLet))[,"n"] + (Word_List%>% add_count(FourLet))[,"n"] + (Word_List%>% add_count(FifthLet))[,"n"]

return(Word_List) }

```

Curt
  • 11
  • 1

0 Answers0