In this example, we use the rgbif package to search for occurrence (lat/long) data for 1000 species
Install and load rgbif
install.packages("rgbif")
library("rgbif")| library(xlsx) | |
| library(smatr) | |
| # get data, from publication Wright et al 2004. DOI: [10.1038/nature02403](http://doi.org/10.1038/nature02403) | |
| download.file("http://www.nature.com/nature/journal/v428/n6985/extref/nature02403-s2.xls", "wright-2004.xls") | |
| dat.Wright <- read.xlsx2("wright-2004.xls", sheetIndex=1, startRow=11, stringsAsFactors=FALSE, check.names=TRUE) | |
| ## Clean data | |
| dat.Wright <- dat.Wright[names(dat.Wright) != " "] # Drop blank columns | |
| for(v in c("log.LMA","log.LL")) |
Command Line
pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)pry -r ./config/environment.rb - load your rails into a pry sessionDebugger
| // run me by installing Rcpp and calling sourceCpp on this file | |
| #include <Rcpp.h> | |
| using namespace Rcpp; | |
| // some initial stuff borrowed from R sources | |
| #ifdef WORDS_BIGENDIAN | |
| static const int hw = 0; | |
| static const int lw = 1; |
| Search PubMed for articles in the PMC Open Access Subset for which free full text (i.e. XML) is available: | |
| http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&retmode=xml&term=pubmed+pmc+open+access%5Bfilter%5D+AND+free+full+text%5Bfilter%5D | |
| Find the PMCID for an article by PMID: | |
| http://eutils.ncbi.nlm.nih.gov/entrez/eutils/elink.fcgi?dbfrom=pubmed&db=pmc&retmode=xml&linkname=pubmed_pmc&id=24191168 | |
| Fetch full text article XML from PMC by PMCID: | |
| http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pmc&id=3804407 | |
| A PMC article for which the full text XML is not available: |
| // 1. Go to page https://www.linkedin.com/settings/email-frequency | |
| // 2. You may need to login | |
| // 3. Open JS console | |
| // ([How to?](http://webmasters.stackexchange.com/questions/8525/how-to-open-the-javascript-console-in-different-browsers)) | |
| // 4. Copy the following code in and execute | |
| // 5. No more emails | |
| // | |
| // Bookmarklet version: | |
| // http://chengyin.github.io/linkedin-unsubscribed/ |
| document.write('<script type="text/javascript" src="http://api.elsevier.com/javascript/scopussearch.jsp"> </' + 'script>'); | |
| callbackCitedbycount = function(){ | |
| if (sciverse.areSearchResultsValid()) { | |
| var resultObj = sciverse.getSearchResults(); | |
| if (resultObj.returnedResults >0) { | |
| citedbycount = resultObj.results[0].citedbycount; | |
| eid = resultObj.results[0].eid; | |
| if (citedbycount > 0) { | |
| citeHtml = '<span class="bold">Scopus times cited</span>:</span> '; |
This is a proof-of-concept of a parser to convert a markdown file to a ctv file, that is required for task views. The basic idea is to use a combination of YAML and markdown sections in the md file, parse it and convert it into a payload, and render it using a template as specified by the ctv package.
Structure of Markdown File
---
name: Working with data on the web
maintainer: Scott Chamberlain, Karthik Ram, Christopher Gandrud
email: scott at ropensci.org
version: 2013-09-17
| /* ============================================ | |
| * bootstrap-infiniteScroll.js | |
| * ============================================ */ | |
| !function ($) { | |
| 'use strict'; | |
| var InfiniteScroll = function (el, options) { | |
| this.$element = $(el); | |
| this.$data = $(el).data(); | |
| this.$options = options; |
| # We first start by creating a way of escaping the characters that have special | |
| # meaning for html, while making sure we don't end up double-escaping at any | |
| # point. The easiest way to do this is to create an S3 class that allows us to | |
| # distinguish between regular text (that needs escaping) and html (that | |
| # doesn't). | |
| # | |
| # We then write an escape method that leaves html unchanged and escapes the | |
| # special characters (&, <, >) in ordinary text. We also add a method for lists | |
| # for convenience |