Rstats

The Latest

May 19, 2013

https://github.com/wactbprot/R4CouchDB

            __  _  _      ___                     _         ___   ___ 
           /__\| || |    / __\ ___   _   _   ___ | |__     /   \ / __\
          / \//| || |_  / /   / _ \ | | | | / __|| '_ \   / /\ //__\//
         / _  \|__   _|/ /___| (_) || |_| || (__ | | | | / /_/// \/  \
         \/ \_/   |_|  \____/ \___/  \__,_| \___||_| |_|/___,' \_____/
                                                                      
                                   _                  ___     ____  
           __   __ ___  _ __  ___ (_)  ___   _ __    / _ \   |___ \ 
           \ \ / // _ \| '__|/ __|| | / _ \ | '_ \  | | | |    __) |
            \ V /|  __/| |   \__ \| || (_) || | | | | |_| |_  / __/ 
             \_/  \___||_|   |___/|_| \___/ |_| |_|  \___/(_)|_____|
                                                                    
                                 _                           
                    ___   _   _ | |_   _ __    ___ __      __
                   / _ \ | | | || __| | '_ \  / _ \\ \ /\ / /
                  | (_) || |_| || |_  | | | || (_) |\ V  V / 
                   \___/  \__,_| \__| |_| |_| \___/  \_/\_/  
                                                             
Sep 17, 2012 / 2 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

Apr 17, 2012 / 2 notes
Apr 5, 2012 / 2 notes
Mar 28, 2012
Jan 16, 2012 / 4 notes
Dec 6, 2011 / 4 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.

Nov 29, 2011 / 2 notes
Oct 18, 2011 / 10 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

Oct 18, 2011 / 37 notes

glob2rx()

generates regExp from nobrainer * expressions

> glob2rx("foo*.bar.*baz")
[1] "^foo.*\\.bar\\..*baz$"
Oct 13, 2011 / 7 notes
Oct 11, 2011 / 24 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*
Oct 6, 2011 / 8 notes