February 2014

An xts R Inferno-ism

February 7, 2014 | Patrick Burns

Another of the all ye entering here. Issue When subscripting an xts object, columns that don’t exist in the object are silently ignored. Example First, create an xts object: xtx xtx a b c 2014-02-07 1 11 21 2014-02-08 2 12 22 2014-02-09 3 […] The post An xts R Inferno-ism appeared first on ... [Read more...]

Linear Models

February 7, 2014 | Christopher Bare

[This article was first published on Digithead's Lab Notebook, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here) Want to share [Read more...]

Plot 3D Topographic Map in R

February 7, 2014 | chenangen

As we all know, there are a lot of packages provide functions to plot maps, such as ggmap, GEOmap, rworldmap and so on. For visualizing 2D topographic map, here is a good example. Besides, 3D topographic map is also easily to be plotted via some excellent functions and packages. The ... [Read more...]

knitr in a knutshell tutorial

February 6, 2014 | Karl Broman

I spent a lot of time this week writing a short tutorial on knitr: knitr in a knutshell. This is my third little tutorial. (The previous ones were a git/github guide and a minimal make tutorial.) I’m pleased with these tutorials. In learning new computing skills, it can ... [Read more...]

Better living through zero-one inflated beta regression

February 6, 2014 | Maxwell B. Joseph

Dealing with proportion data on the interval $[0, 1]$ is tricky. I realized this while trying to explain variation in vegetation cover. Unfortunately this is a true proportion, and can’t be made into a binary response. Further, true 0’s and 1’s rule out beta regression. You could arcsine square root transform ... [Read more...]

Use SQL to operate R data frames

February 6, 2014 | Kun Ren

In both research and application, we need to manipulate data frames by selecting desired columns, filtering records, transforming and aggregating data. R provides built-in functions for data frame manipulation. Suppose df is the data frame we are dealing with. We use df[1:100,] to select the first 100 rows, df[,c("price","... [Read more...]

Statistics and Computing special MCMSk’issue [call for papers]

February 6, 2014 | xi'an

Following the exciting and innovative talks, posters and discussions at MCMski IV, the editor of Statistics and Computing, Mark Girolami (who also happens to be the new president of the BayesComp section of ISBA, which is taking over the management of future MCMski meetings), kindly proposed to publish a special ... [Read more...]

R and the Weather

February 6, 2014 | Joseph Rickert

by Joseph Rickert The weather is on everybody's mind these days: too much ice and snow east of the Rockies and no rain to speak fo in California. Ram Narasimhan has made it a little easier for R users to keep track of what's going on and also get a ... [Read more...]

Random Forest Almighty

February 6, 2014 | Christoph Molnar

Random Forests are awesome. They do not overfit, they are easy to tune, they tell you about important variables, they can be used for classification and regression, they are implemented in many programming languages and they are faster than their competitors (neural nets, boosting, support vector machines, ...)Let us take ... [Read more...]

Optimizing Probability Thresholds for Class Imbalances

February 6, 2014 | Max Kuhn

One of the toughest problems in predictive model occurs when the classes have a severe imbalance. We spend an entire chapter on this subject itself. One consequence of this is that the performance is generally very biased against the class with the smallest frequencies. For example, if the data have ... [Read more...]

An R flaw: unexpected attribute droppings

February 6, 2014 | Lee Pang

Today I was putting some code together that made plots from slices of a 3-dimensional array object aa. A couple of the dimensions in aa had names defined by named vectors. For example:
<span>></span><span> aa </span><span>=</span><span> array</span><span>(</span><span>runif</span><span>(</span><span>2</span><span>*</span><span>3</span><span>*</span><span>4</span><span>),</span><span> <br>             dim</span><span>=</span><span>c</span><span>(</span><span>2</span><span>,</span><span>3</span><span>,</span><span>4</span><span>),</span><span> <br>             dimnames</span><span>=</span><span>list</span><span>(</span><span>id  </span><span>=</span><span> c</span><span>(</span><span>good</span><span>=</span><span>'id1'</span><span>,</span><span> evil</span><span>=</span><span>'id2'</span><span>),</span><span> <br>                           x   </span><span>=</span><span> c</span><span>(</span><span>1</span><span>,</span><span>2</span><span>,</span><span>3</span><span>),</span><span> <br></span><span>var</span><span> </span><span>=</span><span> c</span><span>(</span><span>up</span><span>=</span><span>'a'</span><span>,</span><span> dn</span><span>=</span><span>'b'</span><span>,</span><span> lt</span><span>=</span><span>'c'</span><span>,</span><span> rt</span><span>=</span><span>'d'</span><span>)))</span><span><br></span><span>></span><span> str</span><span>(</span><span>aa</span><span>)</span><span><br> num </span><span>[</span><span>1</span><span>:</span><span>2</span><span>,</span><span> </span><span>1</span><span>:</span><span>3</span><span>,</span><span> </span><span>1</span><span>:</span><span>4</span><span>]</span><span> </span><span>0.0138</span><span> </span><span>0.2942</span><span> </span><span>0.7988</span><span> </span><span>0.3465</span><span> </span><span>0.8751</span><span> </span><span>...</span><span><br></span><span>-</span><span> attr</span><span>(*,</span><span> </span><span>"dimnames"</span><span>)=</span><span>List</span><span> of </span><span>3</span><span><br></span><span>..</span><span>$ id </span><span>:</span><span> </span><span>Named</span><span> chr </span><span>[</span><span>1</span><span>:</span><span>2</span><span>]</span><span> </span><span>"id1"</span><span> </span><span>"id2"</span><span><br></span><span>..</span><span> </span><span>..-</span><span> attr</span><span>(*,</span><span> </span><span>"names"</span><span>)=</span><span> chr </span><span>[</span><span>1</span><span>:</span><span>2</span><span>]</span><span> </span><span>"good"</span><span> </span><span>"evil"</span><span><br></span><span>..</span><span>$ x  </span><span>:</span><span> chr </span><span>[</span><span>1</span><span>:</span><span>3</span><span>]</span><span> </span><span>"1"</span><span> </span><span>"2"</span><span> </span><span>"3"</span><span><br></span><span>..</span><span>$ </span><span>var</span><span>:</span><span> </span><span>Named</span><span> chr </span><span>[</span><span>1</span><span>:</span><span>4</span><span>]</span><span> </span><span>"a"</span><span> </span><span>"b"</span><span> </span><span>"c"</span><span> </span><span>"d"</span><span><br></span><span>..</span><span> </span><span>..-</span><span> attr</span><span>(*,</span><span> </span><span>"names"</span><span>)=</span><span> chr </span><span>[</span><span>1</span><span>:</span><span>4</span><span>]</span><span> </span><span>"up"</span><span> </span><span>"dn"</span><span> </span><span>"lt"</span><span> </span><span>"rt"</span>
Thus, I could access “aliases” for dimension names in id and var by:
<span>></span><span> names</span><span>(</span><span>dimnames</span><span>(</span><span>aa</span><span>)</span><span>$id</span><span>)</span><span><br></span><span>[</span><span>1</span><span>]</span><span> </span><span>"good"</span><span> </span><span>"evil"</span><span><br></span><span>></span><span> names</span><span>(</span><span>dimnames</span><span>(</span><span>aa</span><span>)</span><span>$var</span><span>)</span><span><br></span><span>[</span><span>1</span><span>]</span><span> </span><span>"up"</span><span> </span><span>"dn"</span><span> </span><span>"lt"</span><span> </span><span>"rt"</span>
The code ... [Read more...]

R Studio and "Advanced R Development"

February 5, 2014 | C

Well, I am tuning back in after a brief hiatus (what's a year-or-two-or-four between friends)?  Among other things, I just wrapped up a book for O'Reilly Media (Client-Server Web Apps with JavaScript and Java) due out in the Spring.   Please ... [Read more...]

ggPlot2: Histogram with jittered stripchart

February 5, 2014 | Todos Logos

Here is an example of a Histogram plot, with a stripchart (vertically jittered) along the x side of the plot.Alternatively, using the geom_rug function:Of course this simplicistic method need to be adjusted in vertical position of the stripchart or rug... [Read more...]

Geomorph 1.1-6 Now Available!

February 5, 2014 | Emma Sherratt

Geomorph users,We have uploaded version 1.1-6 to CRAN. The windows and mac binaries have been compiled and the tarball is available.The issue of the Mac OS X installers has been resolved. The problem stemmed from a dependancy (to JPEG), which was ... [Read more...]

In case you missed it: January 2014 roundup

February 5, 2014 | David Smith

In case you missed them, here are some articles from January of particular interest to R users: Princeton’s Germán Rodríguez has published a useful “Introduction to R” guide, with a focus on linear and logistic regression. The rxDForest function in the RevoScaleR package fits random forests of ... [Read more...]
1 9 10 11 12 13 14

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)