Learn R Programming

rplos (version 0.6.4)

plossubject: Search PLoS Journals subjects.

Description

Search PLoS Journals subjects.

Usage

plossubject(q = NULL, fl = "id", fq = NULL, sort = NULL, start = 0, limit = 10, sleep = 6, terms = NULL, fields = NULL, toquery = NULL, callopts = NULL, ...)

Arguments

q
Search terms (character). You can search on specific fields by doing 'field:your query'. For example, a real query on a specific field would be 'author:Smith'.
fl
Fields to return from search (character) [e.g., 'id,title'], any combination of search fields (see the dataset plosfields)
fq
List specific fields to filter the query on (if NA, all queried). The options for this parameter are the same as those for the fl parameter. Note that using this parameter doesn't influence the actual query, but is used to filter the resuls to a subset of those you want returned. For example, if you want full articles only, you can do 'doc_type:full'. In another example, if you want only results from the journal PLOS One, you can do 'cross_published_journal_key:PLoSONE'. See journalnamekey for journal abbreviations.
sort
Sort results according to a particular field, and specify ascending (asc) or descending (desc) after a space; see examples. For example, to sort the counter_total_all field in descending fashion, do sort='counter_total_all desc'
start
Record to start at (used in combination with limit when you need to cycle through more results than the max allowed=1000)
limit
Number of results to return (integer). Setting limit=0 returns only metadta.
sleep
Number of seconds to wait between requests. No need to use this for a single call to searchplos. However, if you are using searchplos in a loop or lapply type call, do sleep parameter is used to prevent your IP address from being blocked. You can only do 10 requests per minute, so one request every 6 seconds is about right.
terms
DEPRECATED PARAMETER - replaced with the q param.
fields
DEPRECATED PARAMETER - replaced with the fl param.
toquery
DEPRECATED PARAMETER - replaced with the fq param.
callopts
DEPRECATED PARAMETER - replaced with the ... param.
...
Optional additional curl options (debugging tools mostly), passed on to GET

Value

Subject content, in addition to any other fields requested in a data.frame.

Faceting

Read more about faceting here: urlhttp://wiki.apache.org/solr/SimpleFacetParameters

Website vs. API behavior

Don't be surprised if queries you perform in a scripting language, like using rplos in R, give different results than when searching for articles on the PLOS website. I am not sure what exact defaults they use on their website. There are a few things to consider. You can tweak which types of articles are returned: Try using the article_type filter in the fq parameter. For which journal to search, e.g., do 'cross_published_journal_key:PLoSONE'. See journalnamekey() for journal abbreviations.

Phrase searching

To search phrases, e.g., synthetic biology as a single item, rather than separate occurrences of synthetic and biology, simply put double quotes around the phrase. For example, to search for cases of synthetic biology, do searchplos(q = '"synthetic biology"'). You can modify phrase searches as well. For example, searchplos(q = '"synthetic biology" ~ 10') asks for cases of synthetic biology within 10 words of each other. See examples.

Details

Details:

See http://www.plosone.org/taxonomy for subject areas.

Examples

Run this code
## Not run: 
# plossubject('marine ecology', limit = 5)
# plossubject(q='marine ecology',  fl = c('id','journal','title'), limit = 20)
# plossubject(q='marine ecology', fl = c('id','journal'),
#    fq='doc_type:full', limit = 9)
# plossubject(q='marine ecology', fl = c('id','journal'),
#    fq=list('doc_type:full','!article_type_facet:"Issue%20Image"'),
#    limit = 9)
# ## End(Not run)

Run the code above in your browser using DataLab