- Notifications
You must be signed in to change notification settings - Fork1
R wrapper for the Petfinder API.
License
aschleg/PetfindeR
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
🐈 🐕 🐓 🐇 🐎
PetfindeR wraps thePetfinder API in an easy-to-use, conveninent R package. ThePetfindeR library also provides handy methods for coercing the returned JSON from the API into usabledata.frame objects to facilitate data analysis and other tasks.
PetfindeR can also be installed from CRAN usinginstall.packages():
install.packages('PetfindeR')Petfinder can also be installed withdevtools to get the most recent production version.
install.packages('devtools')# if devtools is not already installeddevtools::install_github('aschleg/PetfindeR')
Please note the version on CRAN may be behind the most recent version on GitHub. I apologize for any confusion or inconvenience; however, submitting the package to CRAN can often be delayed due to reviews and other submission steps.
An account must first be created withPetfinder to receive an API and secret key. The API and secret key will be used to grant access to the Petfinder API, which lasts for 3600 seconds, or one hour. After the authentication period ends, you must re-authenticate with the Petfinder API. The following are some quick examples for usingPetfindeR to get started. More in-depth tutorials forPetfindeR and some examples of what can be done with the library, please see the More Examples and Tutorials section below.
Authenticating the connection with the Petfinder API is done at the same time thePetfinder class is initialized.
pf= Petfinder(key=key,secret=secret)
# All animal types and their relevant data.all_types=pf$animal_types()# Returning data for a single animal typedogs=pf$animal_types('dog')# Getting multiple animal types at oncecat_dog_rabbit_types=pf$animal_types(c('cat','dog','rabbit'))
cat_breeds=pf$breeds('cat')dog_breeds=pf$breeds('dog')# All available breeds or multiple breeds can also be returned.all_breeds=pf$breeds()cat_dog_rabbit=pf$breeds(types=c('cat','dog','rabbit'))
Theanimals() method returns animals based on specified criteria that are listed in the Petfinder database. Specificanimals can be searched using theanimal_id parameter, or a search of the database can be performed by enteringthe desired search criteria.
# Getting first 20 results without any search criteriaanimals=pf$animals()cats=pf$animals(animal_type='cat',gender='female',status='adoptable',location='Seattle, WA',distance=10,results_per_page=50,pages=2)
Similar to theanimals() method described above, theorganizations() method returns data on animal welfareorganizations listed in the Petfinder database based on specific criteria, if any. In addition to a general searchof animal welfare organizations, specific organizational data can be extracted by supplying theorganizations()method with organization IDs.
# Return the first 1,000 animal welfare organizationsorganizations=pf$organizations(results_per_page=100,pages=10)# Get organizations in the state of Washingtonwa_organizations=pf$organizations(state='WA')
Vignettes are long-form documentation that explore more in-depth concepts related to the package.
AboutPetfinder.com
Petfinder.com is one of the largest online, searchable databases for finding a new pet online. The database contains information on over 14,000 animal shelters and adoption organizations across North America with nearly 300,000 animals available for adoption. Not only does this make it a great resource for those looking to adopt their new best friend, but the data and information provided in Petfinder's database makes it ideal for analysis.
About
R wrapper for the Petfinder API.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Contributors2
Uh oh!
There was an error while loading.Please reload this page.