Can anyone help me with a character syntax issue? I have a vector with a list of numbers:
df$issn
[1] "2369-2960" "1532-2777" "1876-2026" "1872-7727" "1872-7123"
[6] "1532-2777" "1542-7714" "1879-1190" "1090-2139" "1090-2139"
I need to convert them to the following syntax for them to work in my search function from the RISmed package. Don't worry about the details of the package, my issue is more with basic stuff. Here's output doing that:
> EUtilsSummary('2369-2960 OR 1532-2777 OR 1876-2026 OR 1872-7727',
+ retmax=100, mindate= 2018, maxdate= 2021, datetype = "edat")
[1] "\"JMIR Public Health Surveill\"[Journal] OR \"Med Hypotheses\"[Journal] OR \"Asian J Psychiatr\"[Journal] OR \"Eur J Radiol\"[Journal] AND 2018[EDAT] : 2021[EDAT]"
>
So you can see that I need the search to be 'number OR number OR number'. I wrote a paste function to make that happen, which it looks like is working fine:
> issns <- paste0("\'", paste0(unique(df$issn), collapse = " OR "), "\'")
> issns
[1] "'2369-2960 OR 1532-2777 OR 1876-2026 OR 1872-7727 OR 1872-7123 OR 1542-7714 OR 1879-1190 OR 1090-2139 OR 1873-6513...
It's like 800 of these numbers so I cut it off there. Anyway, when I run my function WITH the issns variable, I get an error:
> EUtilsSummary(issns,
+ retmax=100, mindate= 2018, maxdate= 2021, datetype = "edat")
Error in file(con, "r") :
cannot open the connection to 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term='2369-2960+OR+1532-2777+OR+1876-2026+OR+1872-7727+OR+1872-7123+OR+1542-7714+OR+1879-1190+OR+1090-2139+OR+1873-6513+OR+1523-6838+OR+1532-2742+OR+1474-4457+OR+1555
Why is this happening? Theoretically:
- Putting my issns variable should be the same as just typing them out, right?
- Is there some syntax / coding function I'm missing? Have tried a bunch of things with no benefit.