R Programming - Manuals R Basics The R & BioConductor manual provides a general introduction to the usage of the R environment and its basic command syntax. Code Editors for R Several excellent code editors are available that provide functionalities like R syntax highlighting, auto code indenting and utilities to send code/functions to the R console. Programming in R using Vim or Emacs Programming in R using RStudio Integrating R with Vim and Tmux Users interested in integrating R with vim and tmux may want to consult the Vim-R-Tmux configuration page. Finding Help Reference list on R programming (selection)R Programming for Bioinformatics, by Robert GentlemanAdvanced R, by Hadley WickhamS Programming, by W. Control Structures Conditional Executions Comparison Operators equal: ==not equal: ! Logical Operators If Statements If statements operate on length-one logical vectors. Syntax if(cond1=true) { cmd1 } else { cmd2 } Example if(1==0) { print(1) } else { print(2) } [1] 2 Avoid inserting newlines between '} else'. Loops Syntax
Data Science - Community Subsetting · Advanced R. R’s subsetting operators are powerful and fast. Mastery of subsetting allows you to succinctly express complex operations in a way that few other languages can match. Subsetting is hard to learn because you need to master a number of interrelated concepts: The three subsetting operators.The six types of subsetting.Important differences in behaviour for different objects (e.g., vectors, lists, factors, matrices, and data frames).The use of subsetting in conjunction with assignment. This chapter helps you master subsetting by starting with the simplest type of subsetting: subsetting an atomic vector with [. Subsetting is a natural complement to str(). str() shows you the structure of any object, and subsetting allows you to pull out the pieces that you’re interested in. Quiz Take this short quiz to determine if you need to read this chapter. What is the result of subsetting a vector with positive integers, negative integers, a logical vector, or a character vector? Outline Data types Lists !
Rtips. Revival 2014! Paul E. Johnson <pauljohn @ ku.edu> The original Rtips started in 1999. It became difficult to update because of limitations in the software with which it was created. You are reading the New Thing! The first chore is to cut out the old useless stuff that was no good to start with, correct mistakes in translation (the quotation mark translations are particularly dangerous, but also there is trouble with ~, $, and -. (I thought it was cute to call this “StatsRus” but the Toystore’s lawyer called and, well, you know…) If you need a tip sheet for R, here it is. This is not a substitute for R documentation, just a list of things I had trouble remembering when switching from SAS to R. Heed the words of Brian D. 1.1 Bring raw numbers into R (05/22/2012) This is truly easy. myDataFrame <- read.table(‘‘myData’’,header=TRUE) If you type “? Suppose you have tab delimited data with blank spaces to indicate “missing” values. myDataFrame<-read.table("myData",sep="\t",na.strings=" ",header=TRUE) Step 1. or ?
MultiFinder homepage MultiFinder The software is available here via an academic license. In order to automate the motif searches, we developed a software package, termed MultiFinder, that performs automated motif searching using four different profile-based motif finders, including AlignACE, MDscan, BioProspector and MEME. We anticipated that using all four of these motif finders might allow the user to combine the strengths of their different algorithms. The integration of the results from multiple motif finding tools identifies and ranks highly more known and novel motifs than does the use of just one of these tools. The sequence and support files are input files (aqua boxes) required by the sequence extraction script SequenceExtractor.pl to generate a number of input files (gray boxes) required by the motif finders MDscan, BioProspector, MEME, and AlignACE (green boxes). MultiFinder Software Registration and Download Questions or problems should be directed to mlbulyk (at) receptor.med.harvard.edu
Plot maps like a boss A new package OpenStreetMap has been released to CRAN this week which is designed to allow you to easily add satellite imagery, or open street maps to your plots. Raster maps are a great way to add context to your spatial data with a minimum outlay of effort. The syntax in OpenStreetMap is fairly simple, just give it a bounding box in lat/long and it will download a high quality raster image ready for plotting library(OpenStreetMap) library(rgdal) map <- openmap(c(70,-179), c(-70,179)) plot(map) (click for higher quality image) The above code downloads multiple map tiles and stitches together, with the level of zoom determined automatically. We can also access satellite imagery though Bing. map <- openmap(c(70,-179), c(-70,179),type='bing') plot(map) Now, that is all fine and dandy, but kind of useless unless you are able to combine it with your own data. In terms of combining maps with your data there are two options. We may also want to go the other way and transform the image.
Addicted to R · academic/hacker Interactive Playground for R Packages: Part 1 2014-03-20 In this post, I will show you how to create interactive playgrounds for R packages using AngularJS and OpenCPU. I will use the live playground application that I created for rCharts to illustrate the basic idea, which can easily be extended to other packages. rblocks Package v 0.1 2014-03-14 This is a revised post on rblocks, based on some excellent suggestions from Hadley Wickham, Paul Murell and others, on how to enrich the visual representation of data structures. Verbatim Chunks in R Markdown 2014-03-12 This is a short post on how to print knitr code chunks verbatim, preserving all the markup along with chunk options. rBlocks 2014-03-12 This is a post on my experiment at trying to create a visual tool to teach R. NVD3 with rCharts
R tells you where weapons go As an ameturer programmer (one without proper trainings in any mainstream programming language — C and Java) , the more I use R the more I understand the saying — “You are only bounded by your imagination”. The other day I suddenly recalled that someone did a very impressive Facebook map. I then thought it would be nice if I can put these “flows” on the map (or of the same sort) created in my first post. Again, thanks to R, its great community and its openness, I created the following map of international weapon export in 2010 (from top 7 exporters). R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...
ggplot2 Quick Reference | Software and Programmer Efficiency Research Group Our research often involves quantitative studies producing large amounts of data. To analyze and visualize that data we use various tools (and we sometimes develop our own, such as Trevis or LagAlyzer). One of the most effective general information visualization tools we know is Hadley Wickham's ggplot2 package for R. Our pages here provide a quick reference, mostly for our own use. This quick reference is based on ggplot2 version 0.8.8 running on R version 2.11.1. The Anatomy of a Plot In ggplot2, you create a plot using the ggplot() function. Besides a list of layers, a plot also has a coordinate system, scales, and a faceting specification. Each layer uses a specific kind of statistic to summarize data, draws a specific kind of geometric object (geom) for each of the (statistically aggregated) data items, and uses a specific kind of position adjustment to deal with geoms that might visually obstruct each other. The Grammar of Graphics plot ::= coord scale+ facet? Example