https://github.com/wactbprot/R4CouchDB

            __  _  _      ___                     _         ___   ___ 
           /__\| || |    / __\ ___   _   _   ___ | |__     /   \ / __\
          / \//| || |_  / /   / _ \ | | | | / __|| '_ \   / /\ //__\//
         / _  \|__   _|/ /___| (_) || |_| || (__ | | | | / /_/// \/  \
         \/ \_/   |_|  \____/ \___/  \__,_| \___||_| |_|/___,' \_____/
                                                                      
                                   _                  ___     ____  
           __   __ ___  _ __  ___ (_)  ___   _ __    / _ \   |___ \ 
           \ \ / // _ \| '__|/ __|| | / _ \ | '_ \  | | | |    __) |
            \ V /|  __/| |   \__ \| || (_) || | | | | |_| |_  / __/ 
             \_/  \___||_|   |___/|_| \___/ |_| |_|  \___/(_)|_____|
                                                                    
                                 _                           
                    ___   _   _ | |_   _ __    ___ __      __
                   / _ \ | | | || __| | '_ \  / _ \\ \ /\ / /
                  | (_) || |_| || |_  | | | || (_) |\ V  V / 
                   \___/  \__,_| \__| |_| |_| \___/  \_/\_/  
                                                             
0 notes

A R convenience layer for CouchDB

      _____   _      )   ___                ______    ______   
     (, /   ) /   / (__/_____)          /) (, /    ) (, /    ) 
       /__ / /___/_   /       ___    _ (/    /    /    /---(   
    ) /   \_    /    /       (_)(_(_(__/ )__/___ /_ ) / ____)  
   (_/         /    (______)             (_/___ /  (_/ (       

The R4CouchDB package provides a collection of functions for basic database and document management operations such as add and delete.

Every cdbFunction() gets and emits a list containing the connection set up. With the cdbIni() function the cdb$serverName is set to “localhost” as a default. This means that localhost should provide a CouchDB. There are some examples below the demo folder.

Getting started

  • download latest version or clone repository
  • open a shell and install the package with:

     R CMD INSTALL R4couchDB
    

    dependencies (bitopts, RCurl, RJSONIO) can be installed in the same way

  • open R shell and load library with:

     library(R4CouchDB)
    
  • generate a connection object (list()) with:

     foo <- cdbIni()
    
  • play around with foo

     foo$queryParam <- "count=10"
     cdbGetUuidS(foo)$res
    
  • or make a twitter_db and fill up some search results from the request http://search.twitter.com/search.json?q=couchdb

     foo$newDBName  <- "twitter_db"
     foo            <- cdbMakeDB(foo)
     u              <- "http://search.twitter.com/search.json?q=couchdb"
     res            <- fromJSON(getURLContent(u))
     lapply(res$results,
                function(i){
                     foo$dataList <- i
                     cdbAddDoc(foo)})
     foo$res
    
  • get angry and write a ticket on https://github.com/wactbprot/R4CouchDB

3 notes

R and colors from another dimension

I like to have a "x vs. y"- plot in which the symbol colors represent a additional (or another :-) dimension z.

I’m sure that there are several ways to do that, however here is the way I understand.

Assume that x, y and z have the same length n :

    n <- length(y)

At first I generate a vector from z (z will give the color) in the interval [0,1]

     zp   <- z - min(z)    ## zp starts from 0
     zpp <- zp/max(zp)  ## zpp ends at 1

If I now multiply zpp by n I get a nice index vector which can be used together with the result produced by colorRampPalette():

     cf <- colorRampPalette(c("blue","yellow","red"))

cf is a function. It’s argument is the length of the color vector which should be returned. Now put everything together:

      plot(x,y,col=cf(n)[n*zpp])

Here is a complete example:

This is how it looks like:

HTH

2 notes

Incremental Mapreduce for Analytics with R

I’ve been wanting to describe some of my work with using R to help me understand data I’m collecting in Couchbase Server† because I find it quite interesting, useful and easy.

2 notes

How R Searches and Finds Stuff

Or… How to push oneself down the rabbit hole of environments, namespaces, exports, imports, frames, enclosures, parents, and function evaluation?

2 notes

The TeX Catalogue OnLine, Entry for sasnrdisplay, Ctan Edition

The SASnRdisplay package serves as a front-end to the listings, which permits statisticians and others to import source code, and the results of their calculations or simulations into LaTeX projects.

The package is also capable of overloading the Sweave and SASweave packages.

0 notes

RCurl

RCurl in version 1.9-4 available since 5 January 2012

4 notes

Interesting Data Sets and Tools: Monthly Twitter Activity for All Members of the U.S. Congress

nosql:

Drew Conway:

Today I am pleased to announce that we have worked out most of the bugs, and now have a reliable data set upon which to build. Better still, we are ready to share. Unlike our old system, the data now lives on a live CouchDB database, and can be queried for specific research tasks. We have combined all of the data available from Twitter’s search API with the information on each member from Sunlight Foundation’s Congressional API. […] But be forewarned, working with this system and CouchDB requires a mature understanding of several tools and languages; including but not restricted to; curl, map/reduce, Javascript, and JSON. And that’s before you have even done any analysis.

Original title and link: Interesting Data Sets and Tools: Monthly Twitter Activity for All Members of the U.S. Congress (NoSQL database©myNoSQL)

5 notes

wactbnotes

Today I searched an old post. I used the tumblr search without success …

So I’ve started a new blog with some couchdb, git, node.js stuff I wrote last months. This kind of posts I will dump there.

Leave a comment on

wactbnotes

or do it here. The blog is hosted on

http://www.iriscouch.com/

It’s a couchapp. Comments?

I relay hope Wittgenstein will approve.

4 notes

Simply Statistics: Contributions to the R source

simplystatistics:

One of the nice things about tracking the R subversion repository using git instead of subversion is you can do

git shortlog -s -n

which gives you

19855 ripley 
6302 maechler 
5299 hornik 
2263 pd 
1153 murdoch 
813 iacus 
716 luke 
661 jmc 
614 leisch 
472 ihaka
403 murrell 
286 urbaneks 
284 rgentlem
269  apache
253  bates
249  tlumley
164  duncan
92  r
43  root
 40  paul
 40  falcon
 39  lyndon
 34  thomas
 33  deepayan
 26  martyn
 18  plummer
 15  (no author)
 14  guido
  3  ligges
  1  mike

2 notes

Colors in R

simplystatistics:

One of my favorite R packages that I use all the time is the RColorBrewer package. The package has been around for a while now and is written/maintained by Erich Neuwirth. The guts of the package are based on Cynthia Brewer’s very cool work on the use of color in cartography (check out the colorbrewer web site).

As a side note, I think the ability to manipulate colors in plots/graphs/maps is one of R’s many great strengths. My personal experience is that getting the right color scheme can make a difference in how data are perceived in a plot.

Read More

10 notes

glob2rx()

generates regExp from nobrainer * expressions

> glob2rx("foo*.bar.*baz")
[1] "^foo.*\\.bar\\..*baz$"
37 notes

Digithead's Lab Notebook: CouchDB and R

old post partly concerned about my R4CouchDB

7 notes

if:

 checking for gcc... gcc                     
 checking whether the C compiler works... yes
 checking for C compiler default output file name... a.out
 checking for suffix of executables...                    
 checking whether we are cross compiling... no            
 checking for suffix of object files... o                 
 checking whether we are using the GNU C compiler... yes  
 checking whether gcc accepts -g... yes                   
 checking for gcc option to accept ISO C89... none needed 
 USE_LOCAL = ""                                           
 Using local libjson code. Copying files                  
 /tmp/Rtmp2n5YCn/R.INSTALL38c6756b/RJSONIO                
 configure: creating ./config.status                      
 config.status: creating src/Makevars                     
 config.status: creating cleanup                          
 ** libs                                                  
 gcc -std=gnu99 -I/usr/lib/R/include -I. ....

 make: g++: Kommando nicht gefunden
 make: *** [JSONChildren.o] Fehler 127            
 ERROR: compilation failed for package ‘RJSONIO’  

then:

 # ln -s g++-4.4 g++                                      
 # l g++                                                  
 lrwxrwxrwx 1 root root 7 11. Okt 13:09 g++ -> g++-4.4*
24 notes