Showing posts with label Ecology. Show all posts
Showing posts with label Ecology. Show all posts

Friday, December 23, 2011

Recology is 1 yr old...

Recology has moved, go to http://recology.info/2011/12/recology-is-1-yr-old

This blog has lasted a whole year already.  Thanks for reading and commenting.

There are a couple of announcements:
  1. Less blogging:  I hope to put in many more years blogging here, but in full disclosure, I am blogging for Journal of Ecology now, so I am going to be (and already have been) blogging less here. 
  2. More blogging:  If anyone wants to write guest posts at Recology on the topics of using R for ecology and evolution, or open science, please contact me! 
  3. Different blogging:  I was going to roll out the new dynamic views for this blog, but Google doesn't allow javascript, which is how I include code using GitHub gists. Oh well... 

Anywho, here is the breakdown of visits to this blog, visualized using #ggplot2, of course.  There were a total of about 23,000 pageviews in the first year of this blog.      Here is the pie chart code I used:




Visits to top ten posts:


Visits by by pages:



Visits by top referring sites:


Visits by country:


Visits by browsers:


Visits by operating system:



Thursday, October 27, 2011

Two new rOpenSci R packages are on CRAN

Recology has moved, go to http://recology.info/2011/10/two-new-ropensci-r-packages-are-on-cran

Carl Boettiger, a graduate student at UC Davis, just got two packages on CRAN.  One is treebase, which which handshakes with the Treebase API.  The other is rfishbase, which connects with the Fishbase, although I believe just scrapes XML content as there is no API.  See development on GitHub for treebase here, and for rfishbase here.  Carl has some tutorials on treebase and rfishbase at his website here, and we have an official rOpenSci tutorial for treebase here.

Basically, these two R packages let you search and pull down data from Treebase and Fishbase - pretty awesome.  This improves workflow, and puts your data search and acquisition component into your code, instead of being a bunch of mouse clicks in a browser.

These two packages are part of the rOpenSci project.

Wednesday, October 26, 2011

Two-sex demographic models in R

Recology has moved, go to http://recology.info/2011/10/two-sex-demographic-models-in-r

Tom Miller (a prof here at Rice) and Brian Inouye have a paper out in Ecology (paper, appendices) that confronts two-sex models of dispersal with empirical data.

They conducted the first confrontation of two-sex demographic models with empirical data on lab populations of bean beetles Callosobruchus.

Their R code for the modeling work is available at Ecological Archives (link here).


Here is a figure made from running the five blocks of code in 'Miller_and_Inouye_figures.txt' that reproduces Fig. 4 (A-E) in their Ecology paper (p = proportion female, Nt = density).  Nice!
A: Saturating density dependence
B: Over-compensatory density dependence
C: Sex-specific gamma's (but bM=bF=0.5)
D: Sex-specific b's (but gammaM=gammaF=1)
E: Sex-specific b's (but gammaM=gammaF=2)


Thursday, October 13, 2011

Phylogenetic community structure: PGLMMs

Recology has moved, go to http://recology.info/2011/10/phylogenetic-community-structure-pglmms


So, I've blogged about this topic before, way back on 5 Jan this year.

Matt Helmus, a postdoc in the Wootton lab at the University of Chicago, published a paper with Anthony Ives in Ecological Monographs this year (abstract here).  The paper addressed a new statistical approach to phylogenetic community structure.

As I said in the original post, part of the power of the PGLMM (phylogenetic generalized linear mixed models) approach is that you don't have to conduct quite so many separate statistical tests as with the previous null model/randomization approach.

Their original code was written in Matlab.  Here I provide the R code that Matt has so graciously shared with me.  There are four functions and a fifth file has an example use case.  The example and output are shown below.

Look for the inclusion of Matt's PGLMM to the picante R package in the future.

Here are links to the files as GitHub gists: 
PGLMM.data.R:  https://gist.github.com/1278205
PGLMM.fit.R:  https://gist.github.com/1284284
PGLMM.reml.R:  https://gist.github.com/1284287
PGLMM.sim.R:  https://gist.github.com/1284288
PGLMM_example.R:  https://gist.github.com/1284442

Enjoy!


The example


..and the figures...



Thursday, September 22, 2011

Open science talk by Carl Boettiger

Recology has moved, go to http://recology.info/2011/09/open-science-talk-by-carl-boettiger

Carl Boettiger gave a talk on the topic of open science to incoming UC Davis graduate students.

Here is the audio: http://www.archive.org/details/ThingsIWishIKnewThreeYearsAgo-ByTheDavisOpenScienceGroup&reCache=1

Here are the slides: http://hazelnusse.github.com/DOS_WOW2011/#title-slide

Wednesday, August 31, 2011

rnpn: An R interface for the National Phenology Network

Recology has moved, go to http://recology.info/2011/08/rnpn-r-interface-for-national-phenology

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 (here) or at our website  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"

Friday, August 12, 2011

Thursday at #ESA11

Recology has moved, go to http://recology.info/2011/08/thursday-at-esa11

Interesting talks/posters:

Richard Lankau presented research on trade-offs and competitive ability. He suggests that during range expansion selection for increased intraspecific competitive ability in older populations leads to loss of traits for interspecific competitive traits due to trade-offs between these traits.


Ellner emphatically states that rapid evolution DOES matter for ecological responses, and longer-term evolutionary patterns as well. [His paper on the talk he was giving came out prior to his talk, which he pointed out, good form sir]


Lauren Sullivan gave an interesting talk on bottom up and top down effects on plant reproduction in one site of a huge network of sites doing similar nutrient and herbivory manipulations around the globe - NutNet (go here: http://nutnet.science.oregonstate.edu/).


Laura Prugh shows in California that the engineering effects (i.e., the mounds that they make) of giant kangaroo rats are more important for the associated food web than the species interaction effects (the proxy used was just density of rats).


Kristy Deiner suggests that chironomids are more phylogenetic similar in lakes with stocked fish relative to fishless lakes, in high elevation lakes in the Sierra Nevada. She used barcode data to generate her phylogeny of chironomids. If you have barcode data and want to search BOLD Systems site, one option is doing it from R using rbold, a package under development at rOpenSci (code at Github).


Jessica Gurevitch presented a large working group's methods/approach to a set of reviews on invasion biology. We didn't get to see a lot of results from this work, but I personally was glad to see her explaining to a packed room the utility of meta-analysis, and comparing to the medical field in which meta-analysis is sort of the gold standard by which to draw conclusions.


Following Jessica, Jason Fridley told us about the Evolutionary Imbalance Hypothesis (EIH) (see my notes here). He posed the problem of, when two biotas come together, what determines which species are retained in this new community and which species are left out. He listed a litany of traits/responses to measure to get at this problem, but suggested that with a little bit of "desktop ecology", we could simply ask: Is the invasability of X region related to the phylogenetic diversity of that region? In three destination regions (Eastern Deciduous Forests, Mediterranean California, and the Czech Republic) out of four there was a positive relationship between proportion of invasive plant species in a source region and the phylogenetic diversity of the source regions.

    Thursday, August 11, 2011

    Wednesday at #ESA11

    Recology has moved, go to http://recology.info/2011/08/wednesday-at-esa11

    Interesting talks/posters:

    • Ethan White's poster describing EcologicalData.org was of course awesome given my interest in getting data into the hands of ecologists over at rOpenSci.org. Ethan also has software you can download on your machine to get the datasets you want easily - EcoData Retriever. [rOpenSci will try to take advantage of their work and allow you to call the retriever from R]
    • Carl Boettiger's talk was awesome. He explained how we need better tools to be able to predict collapses using early warning signals. He developed a way to estimate the statistical distribution of probabilities of system collapse. 
    • Jennifer Dunne: Explained how she put together an ancient network from Germany. Bravo. 
    • Carlos Melian explained his model of network buildup that starts from individuals, allows speciation, and other evolutionary processes. 
    • Rachel Winfree told us that in two sets of mutualistic plant-pollinator networks in New Jersey and California, that the least connected pollinator species were the most likely to be lost from the network with increasing agricultural intensity. 
    • Dan Cariveau suggests that pollination crop services can be stabilized even with increasing agriculture intensity if in fact pollinator species respond in different ways. That is, some pollinators may decrease in abundance with increasing ag intensity, while other species may increase - retaining overall pollination services to crops.

      Monday, August 8, 2011

      Monday at #ESA11

      Recology has moved, go to http://recology.info/2011/08/monday-at-esa11

      Monday was a good day at ESA in Austin. There were a few topics I promised to report on in my blogging/tweeting.


      ...focused on open source data. Carly Strasser's presentation on guidelines for data management was awesome (including other talks in the symposium on Creating Effective Data Management Plans for Ecological Research). Although this was a good session, I can't help but wish that they had hammered home the need for open science more. Oh well. Also, they talked a lot about how, and not a lot of why we should properly curate data. Still, a good session. One issue Carly and I talked about was tracking code in versioning systems such as Github. There doesn't seem to be a culture of versioning code for analyses/simulations in ecology. But when we get there...it will be easier to share/track/collaborate on  code.

      ...used R software. David Jennings talked about a meta-analysis asking if phylogenetic distance influences competition strength in pairwise experiments. David used the metafor package in R to do his meta-analysis. Good form sir.

      ...did cool science. Matt Helmus presented a great talk on phylogenetic species area curves (likely using R, or Matlab maybe?).


      p.s. We launched rOpenSci today.


      Oddities:
      • The Tilman effect - Tilman's talk was so packed it looked like there was a line waiting to get into a trendy bar. Here's a picture (credit: Jaime Ashander). Bigger room next time anyone? 
      • Wiley came out with an open source journal called Ecology and Evolution. This brings them to 3 open source journals (the other two are in other fields). We (rOpenSci) will attempt to hand-shake with these journals. 
      • The vegetarian lunch option was surprisingly good. Nice. 

      (#ESA11) rOpenSci: a collaborative effort to develop R-based tools for facilitating Open Science

      Recology has moved, go to http://recology.info/2011/08/esa11-ropensci-collaborative-effort-to_08

      Our development team would like to announce the launch of rOpenSci. As the title states, this project aims to create R packages to make open science more available to researchers.

      http://ropensci.org/

      What this means is that we seek to connect researchers using R with as much open data as possible, mainly through APIs. There are a number of R packages that already do this (e.g., infochimps, twitteR), but we are making more packages, e.g., for Mendeley, PLoS Journals, and taxonomic sources (ITIS, EOL, TNRS, Phylomatic, UBio).

      Importantly, we are creating a package called rOpenSci, which aims to integrate functions from packages for individual open data sources.

      If you are somewhat interested, follow our progress on our website, on Twitter, or contact us. If you are really^2 interested you could go to Github and contribute. If  you are really^3 interested, join our development team.

      Sunday, July 31, 2011

      Blogging/tweeting from #ESA11

      Recology has moved, go to http://recology.info/2011/07/bloggingtweeting-from-esa11

      I will be blogging about the upcoming Ecological Society of America meeting in Austin, TX. I will focus on discussing talks/posters that:

      1. Have taken a cool approach to using data, or
      2. Have focused on open science/data, or
      3. Done something cool with R software, or
      4. Are just exciting in general

      I will also tweet throughout the meeting from @recology_ (yes the underscore is part of the name, recology was already taken). 

      The hashtag for the meeting this year is #ESA11

      Wednesday, June 22, 2011

      iEvoBio 2011 Synopsis

      We just wrapped up the 2011 iEvoBio meeting. It was awesome! If you didn't go this year or last year, definitely think about going next year.


      Here is a list of the cool projects that were discussed at the meeting (apologies if I left some out):
      1. Vistrails: workflow tool, awesome project by Claudio Silva
      2. Commplish: purpose is to use via API's, not with the web UI
      3. Phylopic: a database of life-form silouhettes, including an API for remote access, sweet!
      4. Gloome
      5. MappingLife: awesome geographic/etc data visualization interace on the web
      6. SuiteSMA: visualizating multiple alignments
      7. treeBASE: R interface to treebase, by Carl Boettiger
      8. VertNet: database for vertebrate natural history collections
      9. RevBayes: revamp of MrBayes, with GUI, etc. 
      10. Phenoscape Knowledge Base
        • Peter Midford lightning talk: talked about matching taxonomic and genetic data
      11. BiSciCol: biological science collections tracker
      12. Ontogrator 
      13. TNRS: taxonomic name resolution service
      14. Barcode of Life data systems, and remote access
      15. Moorea Biocode Project
      16. Microbial LTER's data
      17. BirdVis: interactive bird data visualization (Claudio Silva in collaboration with Cornell Lab of Ornithology)
      18. Crowdlabs: I think the site is down right now, another project by Claudio Silva
      19. Phycas: Bayesian phylogenetics, can you just call this from R?
      20. RIP MrBayes!!!! replaced by RevBayes (see 9 above)
      21. Slides of presentations will be at Slideshare (not all presentations up yet)          
      22. A birds of a feather group I was involved in proposed an idea (TOL-o-matic) like Phylomatic, but of broader scope, for easy access and submission of trees, and perhaps even social (think just pushing a 'SHARE' button within PAUP, RevBayes, or other phylogenetics software)! 
      23. Synopses of Birds of a Feather discussion groups: http://piratepad.net/iEvoBio11-BoF-reportouts

      Sunday, March 13, 2011

      Species abundance distributions and basketball

      A post over at the Phased blog (http://www.nasw.org/users/mslong/) highlights a recent paper in PLoS One by Robert Warren et al. Similar results were obtained in a 2007 Ecology Letters paper by Nekola and Brown, who showed that abundance distributions found in ecology are similar to those found for scientific citations, Eastern North American precipitation, among other things. A similar argument was made by Nee et al. in 1991 (in the journal PRSL-B). The author of the blog appears to agree with the outcome of the Warren et al. study.

      I tend to disagree.

      In the field of graphs/networks, many networks (social, sexual intercourse among humans, etc.) are found to have similar statistical properties to those of ecological networks (food webs, interactions among mutualists, etc.). However, just because these networks have similar statistical properties does not mean that the statistical properties of ecological networks have no biological meaning.

      They make the argument that the common SAD fit may be an artifact of large data sets alone. However, I don't see any explanation of why they think large data sets is a valid explanation of SADs. Surely SAD's are fit to varying sizes of datasets. The problem with small datasets is lack of statistical power to detect a particular pattern, but surely you can get a fit for a particular SAD to a small dataset.

      There are ecological mechanistic theories behind different SAD models. They argue that because very similar SADs are found in ecological and non-ecological datasets alike one option is that a universal mechanism structures ecological and non-ecological data (with the mechanism unknown in both). Why can't the same SAD pattern be generated by different mechanisms?

      Are Warren et al, Nekola, and Nee right in questioning the utility of SADs? Questioning our theories and ideas only makes the theories better in the end by weeding out shortcomings, etc.


      ResearchBlogging.org
      Warren, R., Skelly, D., Schmitz, O., & Bradford, M. (2011). Universal Ecological Patterns in College Basketball Communities PLoS ONE, 6 (3) DOI: 10.1371/journal.pone.0017342

      Wednesday, February 9, 2011

      Troubling news for the teaching of evolution

      [UPDATE: i remade the maps in green, hope that helps...]

      A recent survey reported in Science ("Defeating Creationism in the Courtroom, but not in the Classroom") found that biology teachers in high school do not often accept the basis of their discipline, as do teachers in other disciplines, and thus may not teach evolution appropriately. Read more here: New York Times.

      I took a little time to play with the data provided online along with the Science article. The data is available on the Science website along with the article, and the dataset I read into R is unchanged from the original. The states abbreviations file is here (as a .xls). Here goes:

      I only played with two survey questions: q1b (no. of hours ecology is taught per year), and q1d (no. of hours evolution is taught per year). I looked at ecology and evolution as this blog is about ecology and evolution. It seems that some states that teach a lot of ecology teach a lot of evolution, but I found no correlation between the two without extreme outliers. I couldn’t help but notice my home state, TX, is near the bottom of the list on both counts - go TX! The teaching of evolution on the map produced below is less predictable than I would have though just based on my assumptions about political will in each state.


      # Analyses of Conditionality Data set of all variables, except for latitude, etc.
      setwd("/Mac/R_stuff/Blog_etc/EvolutionTeaching/") # Set working directory
      library(ggplot2)
       
      # read in data, and prepare new columns
      survey <- read.csv("berkmandata.csv")
      str(survey) # (I do realize that survey is a data object in the MASS package)
       
      # Assign actual hours to survey answers 
      ecol <- gsub(1, 0, survey$q1b)
      ecol <- gsub(2, 1.5, ecol)
      ecol <- gsub(3, 4, ecol)
      ecol <- gsub(4, 8, ecol)
      ecol <- gsub(5, 13, ecol)
      ecol <- gsub(6, 18, ecol)
      ecol <- gsub(7, 20, ecol)
       
      evol <- gsub(1, 0, survey$q1d)
      evol <- gsub(2, 1.5, evol)
      evol <- gsub(3, 4, evol)
      evol <- gsub(4, 8, evol)
      evol <- gsub(5, 13, evol)
      evol <- gsub(6, 18, evol)
      evol <- gsub(7, 20, evol)
       
      survey$ecol <- as.numeric(ecol)
      survey$evol <- as.numeric(evol)
       
      # ddply it
      survey_sum <- ddply(survey, .(st_posta), summarise,
       mean_ecol_hrs = mean(ecol, na.rm=T),
       mean_evol_hrs = mean(evol, na.rm=T),
       se_ecol_hrs = sd(ecol, na.rm=T)/sqrt(length(ecol)),
       se_evol_hrs = sd(evol, na.rm=T)/sqrt(length(evol)),
       num_teachers = length(st_posta)
      )
       
      # plotting
      limits_ecol <- aes(ymax = mean_ecol_hrs + se_ecol_hrs, ymin = mean_ecol_hrs - se_ecol_hrs)
      limits_evol <- aes(ymax = mean_evol_hrs + se_evol_hrs, ymin = mean_evol_hrs - se_evol_hrs)
       
      ggplot(survey_sum, aes(x = reorder(st_posta, mean_ecol_hrs), y = mean_ecol_hrs)) +
       geom_point() +
       geom_errorbar(limits_ecol) +
       geom_text(aes(label = num_teachers), vjust = 1, hjust = -3, size = 3) +
       coord_flip() +
       labs(x = "State", y = "Mean hours of ecology taught \n per year (+/- 1 se)")
      
      ####SMALL NUMBERS BY BARS ARE NUMBER OF TEACHERS THAT RESPONDED TO THE SURVEY

       
      ggplot(survey_sum, aes(x = reorder(st_posta, mean_evol_hrs), y = mean_evol_hrs)) +
       geom_point() +
       geom_errorbar(limits_evol) +
       geom_text(aes(label = num_teachers), vjust = 1, hjust = -3, size = 3) +
       coord_flip() +
       labs(x = "State", y = "Mean hours of evolution taught \n per year (+/- 1 se)")
       ####SMALL NUMBERS BY BARS ARE NUMBER OF TEACHERS THAT RESPONDED TO THE SURVEY
      
      
       
      # map
      try_require("maps")
      states <- map_data("state")
      statenames <- read.csv("/Mac/R_stuff/Code/states_abbreviations.csv")
      survey_sum_ <- merge(survey_sum, statenames, by.x = "st_posta", by.y = "state_abbrev")
      survey_sum_map <- merge(states, survey_sum_, by.x = "region", by.y = "state")
      survey_sum_map <- survey_sum_map[order(survey_sum_map$order), ]
       
      
      qplot(long, lat, data = survey_sum_map, group = group, fill = mean_ecol_hrs, geom = "polygon") + scale_fill_gradient(low="black", high="green")
      
      
      

       
      
      
      qplot(long, lat, data = survey_sum_map, group = group, fill = mean_evol_hrs, geom = "polygon") + scale_fill_gradient(low="black", high="green")
      
      
      
      
      Created by Pretty R at inside-R.org

      Tuesday, February 1, 2011

      Plants are less sex deprived when next to closely related neighbors

      A new early online paper in American Journal of Botany by Risa Sargent and colleagues suggests that plants are less sex deprived (pollen limited) in vernal pools that have more closely related plant species.

      Vernal pools are (at least in my experience) small (to quite large) depressions that fill up with water with winter rains, and dry out completely in the summer. Vernal pool adapted plants flower in rings down the pool as the water dries up. Aquatic invertebrates and some herps can last through the summer by burrowing in the soil.

      The study did hand pollination experiments with a focal species, Lasthenia fremontii. They examined the relationship between these pollen limitation experiments and the relatedness of L. fremontii to the rest of the plant community in each pool.

      Plant species richness was not related to pollen limitation. Thus, at least in their study with vernal pools in California, relatedness to your plant neighbors has a greater impact than plant richness.

      The great thing about vernal pools is that they are truly terrestrial islands of habitat, surrounded by inhospitable habitat for pool species. Many vernal pools are created artificially for habitat conservation easements (e.g., here). Perhaps someone can experimentally manipulate phylogenetic diversity in artificially created pools to really get at the causal links.






      p.s. Ok, this post is not terribly R related, except for that this paper used R for some of their statistics.

      Monday, January 17, 2011

      R and Google Visualization API: Fish harvests

      I recently gathered fish harvest data from the U.S. National Oceanic and Atmospheric Administarion (NOAA), which I downloaded from Infochimps. The data is fish harvest by weight and value, by species for 21 years, from 1985 to 2005.

      Here is a link to a google document of the data I used below. I had to do some minor pocessing in Excel first; thus the link to this data.
      https://spreadsheets.google.com/ccc?key=0Aq6aW8n11tS_dFRySXQzYkppLXFaU2F5aC04d19ZS0E&hl=en

      Get the original data from Infochimps here:
      http://infochimps.com/datasets/domestic-fish-and-shellfish-catch-value-and-price-by-species-198
      
      
      
      
      
      
      
      
      ################# Fish harvest data ########################################
      setwd("/Mac/R_stuff/Blog_etc/Infochimps/Fishharvest") # Set path
      library(ggplot2)
      library(googleVis)
      library(Hmisc)
       
      fish <- read.csv("fishharvest.csv") # read data
      fish2 <- melt(fish,id=1:3,measure=4:24) # melt table
      year <- rep(1985:2005, each = 117)
      fish2 <- data.frame(fish2,year) # replace year with actual values
       
      # Google visusalization API
      fishdata <- data.frame(subset(fish2,fish2$var == "quantity_1000lbs",-4),value_1000dollars=subset(fish2,fish2$var == "value_1000dollars",-4)[,4])
      names(fishdata)[4] <- "quantity_1000lbs"
      fishharvest <- gvisMotionChart(fishdata, idvar="species", timevar="year")
      plot(fishharvest)
      Created by Pretty R at inside-R.org




      Data: fishdata, Chart ID: MotionChart_2011-01-17-08-09-24


      R version 2.12.1 (2010-12-16),

      Google Terms of Use



      fishdatagg2 <- ddply(fish2,.(species,var),summarise,
       mean = mean(value),
       se = sd(value)/sqrt(length(value))
      )
      fishdatagg2 <- subset(fishdatagg2,fishdatagg2$var %in% c("quantity_1000lbs","value_1000dollars"))
      limit3 <- aes(ymax = mean + se, ymin = mean - se)
      bysppfgrid <- ggplot(fishdatagg2,aes(x=reorder(species,rank(mean)),y=mean,colour=species)) + geom_point() + geom_errorbar(limit3) + facet_grid(. ~ var, scales="free") + opts(legend.position="none") + coord_flip() + scale_y_continuous(trans="log")
      ggsave("bysppfgrid.jpeg")
      Created by Pretty R at inside-R.org