Good lord, after all that work, it added 100 or so journals to the list, and only 2 or 3 more to the graph! Still need to run the query on the remaining 27.
The problem here was that the intersection was not accounting for spaces.
This adds a trim function from the stringr package to the doaj.list.
Then in the function it creates a variable Clean.Journal.Name which is a list of the department journals, applying the trim function and converting it to uppercase (in previous versions, the conversion was done in the assembly of the next data frame).
Accounting for trailing spaces. Modifies each function to add the str-trim function. Notice the changes in the intersection counts. Notice there were NO changes in the scopus.aa intersection, indicating that all the spacing trouble came from the DOAJ list.
Lesson: clean your character strings of trailing spaces before any analysis.
This is some experimentation with eliminating spaces. Here is where I discovered the spacing problem.
If I use the str_replace_all on DOAJ, I discover even more issues. There are still 27 journals on the DOAJ list that are not being picked up in the AA list because the spacing issues occur in the middle of the character string. Next time I will loop through and see if that even matters (ie if our researchers are even publishing in those) by adding the str_replace_all function to the disciplineOA loop and the doaj.list.
Change variable names to be more descriptive.
Add in oa.journals function from disciplineOA.R to test the missing name variables (the ones with spacing issues).
Add in functions from Spaces.R:
- doaj.aa.trim returns an intersection of the DOAJ list and the AA list with leading/trailing spaces deleted.
- doaj.aa.repl returns an intersection of the DOAJ list and the AA list with all spaces deleted.
- missing returns a vector of the intersection of all journals that are not on the doaj.aa.trim list but are on the doaj.aa.repl list. These journals have spacing issues within the string name (typically involving spacing conventions around punctuation that differ between lists).

Changes the Clean.Journal.Name to Trimmed.Journal.Name; the specificity reflecting the fact that both the trimmed and the replaced journal names are "cleaned."

Modifies the oa.journals function to include a second loop, running through the small missing list to pick up any publications that match on that list. In this case, it was only two electrical engineering journals.