rnpn: An R interface for the National Phenology Network

[This article was first published on Recology, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

The team at rOpenSci and I have been working on a wrapper for the USA National Phenology Network API. The following is a demo of some of the current possibilities. We will have more functions down the road. Get the publicly available code, and contribute, at Github here. If you try this out look at the Description file for the required R packages to run rnpn. Let us know at Github or at http://ropensci.org/, or in the comments below, or on twitter (@rOpenSci), what use cases you would like to see with the rnpn package.

Method and demo of each:
Get observations for species by day
From the documentation: “This function will return a list of species, containing all the dates which observations were made about the species, and a count of the number of such observations made on that date.

#### Note, the data below is truncated for blogging brevity…

> getobsspbyday(c(1, 2), '2008-01-01', '2011-12-31') # Searched for species 1 and 2 from Jan 1, 2008 to Dec 31, 2011

          date count   species

1   2009-03-08     2 species 1

2   2009-03-15     1 species 1

3   2009-03-22     1 species 1

4   2009-03-24     1 species 1

5   2009-03-26     1 species 1

6   2009-04-17     1 species 1

7   2009-04-24     1 species 1

8   2009-05-12     1 species 1

9   2009-05-20     1 species 1

10  2009-11-24     1 species 1

11  2009-12-07     1 species 1

12  2010-01-18     1 species 1

13  2010-01-23     1 species 1

62  2011-05-29     1 species 1

63  2011-06-27     1 species 1

64  2011-06-30     2 species 1

65  2009-03-17     1 species 2

66  2009-04-03     3 species 2

67  2009-04-05     3 species 2

68  2009-04-10     3 species 2

69  2009-04-17     3 species 2



Get individuals at specific stations
From the documentation: “This function returns all of the individuals at a series of stations.

> getindsatstations(c(507, 523)) # Searched for any individuals at stations 507 and 523

   individual_id individual_name species_id kingdom

1           1200         dogwood         12 Plantae

2           1197    purple lilac         36 Plantae

3           1193         white t         38 Plantae

4           3569     forsythia-1         73 Plantae

5           1206            jack        150 Plantae

6           1199      trout lily        161 Plantae

7           1198           dandy        189 Plantae

8           1192           red t        192 Plantae

9           1710    common lilac         36 Plantae

10          1711  common lilac 2         36 Plantae

11          1712       dandelion        189 Plantae







Get individuals of species at stations
From the documentation: “This function will return a list of all the individuals, which are members of a species, among  any number of stations.

> getindspatstations(35, c(60, 259), 2009)  # Search for individuals of species 35 at stations 60 and 259 in year 2009

  individual_id individual_name number_observations

1          1715            west                   5

2          1716            east                   5







Get observation associated with particular observation
From the documentation: This function will return the comment associated with a particular observation.

> getobscomm(1938) # The observation for observation number 1938

$observation_comment

[1] "some lower branches are bare"

To leave a comment for the author, please follow the link and comment on their blog: Recology.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)