Articles by Yihui Xie

formatR update (0.1-5)

December 3, 2010 | Yihui Xie

he formatR package has been silent for quite a few months now. Recently I’ve been moving my old packages from R-Forge to GitHub, and I finally killed several things on my TODO list. In the past, I made an awkward decision to let formatR depend on the animation package, ... [Read more...]

Rd2roxygen: Convert Rd to roxygen documentation

December 1, 2010 | Yihui Xie

must admit that I have been tired of maintaining my R packages for a long time, and the main reason is I feel really uncomfortable with writing R documentations (Rd). The required structure of an R package mainly includes two directories R and man — the former for the R source ... [Read more...]

How to Start Using (pgf)Sweave in LyX in One Minute

October 30, 2010 | Yihui Xie

regor Gorjanc published an interesting article “Using Sweave with LyX” in R News in 2008, which (I believe) makes it much easier to use Sweave. I use command-line tools a lot every day, but I am still “GUI-addicted”. (I don’t want to comment more about Microsoft Word here.) LyX is ... [Read more...]

On the Gory Loops in R

October 17, 2010 | Yihui Xie

his blog post is mainly for Stat 579 students on the homework for week 7, since I received too many “gory” loops in the homework submissions and I think it would help a bit to write my thoughts on R loops for beginners. The immortal motto for newbies in programming is: If ... [Read more...]

A Slider to Control Two Plotting Windows

September 28, 2010 | Yihui Xie

One of my readers asked two weeks ago how to control two graphics windows with the slider in gWidgets. Here is a simple example: if (!require("gWidgetsRGtk2")) install.packages("gWidgetsRGtk2") library(gWidgetsRGtk2) options(guiToolkit = "RGtk2") graphics.off() x11() x11() dev.set() gslider(from = 1, to = 100, value = 10,     container = gwindow("Two Plotting Windows"), ... [Read more...]

SyntaxHighlighter Brush for the R Language

September 11, 2010 | Yihui Xie

al Galili requested in the R-help mailing list for a SyntaxHighlighter brush for the R language, so that WordPress users can highlight their R code easily. I promised to contribute a few minutes on this task, and here is the result: /** * Author: Yihui Xie * URL: http://yihui.name/en/2010/09/syntaxhighlighter-brush-for-the-r-language * ... [Read more...]

Auto-completion in Notepad++ for R Script

August 14, 2010 | Yihui Xie

Auto-completion is fancy in a text editor. Notepad++ does not support auto-completion for the R language, so I spent a couple of hours on creating such an XML file to support R: Put it under ‘plugins/APIs‘ in the installation directory of Notepad++ (you can see several other XML files ... [Read more...]

alphahull: an R Package for Alpha-Convex Hull

April 16, 2010 | Yihui Xie

new paper on the α-convex hull appeared in the Journal of Statistical Software today (http://www.jstatsoft.org/v34/i05/paper). The α-convex hull is an interesting problem which caught my attention long time ago but I didn’t know a solution then. R has a function chull() which can ... [Read more...]

R is an Epic Fail?

April 15, 2010 | Yihui Xie

I came across this blog post just now: The Next Big Thing, and of course these words caught my attention: [...] However, for me personally and for most users, both individual and organizational, the much greater cost of software is the time it takes to install it, maintain it, learn it ... [Read more...]

formatR: farewell to ugly R code

April 13, 2010 | Yihui Xie

It is not uncommon to see messy R code which is almost not human-readable like this: # rotation of the word "Animation" # in a loop; change the angle and color # step by step for (i in 1:360) { # redraw the plot again and again plot(1,ann=FALSE,type="n",axes=FALSE) # rotate; use ... [Read more...]

Demonstrating the Power of F Test with gWidgets

April 2, 2010 | Yihui Xie

e know the real distribution of the F statistic in linear models — it is a non-central F distribution. Under H0, we have a central F distribution. Given 1 – α, we can compute the probability of (correctly) rejecting H0. I created a simple demo to illustrate how the power changes as other parameters ... [Read more...]

Looking for Software Paths in Windows Registry

March 28, 2010 | Yihui Xie

hen we want to call external programs in R under Windows, we often need to know the paths of these programs. For instance, we may want to know where ImageMagick is installed, as we need the convert (convert.exe) utility to convert images to other formats, or where OpenBUGS is ... [Read more...]

Font Families for the R PDF Device

March 24, 2010 | Yihui Xie

otivated by the excellent R package pgfSweave, I begin to notice the font families in my graphs when writing Sweave documents. The default font family for PDF graphs is Helvetica, which is, in most cases (I think), inconsistent with the LaTeX font styles. Some common font families are listed in ?... [Read more...]

R Tips in Stat 511

March 22, 2010 | Yihui Xie

Here are some (trivial) R tips in the course Stat 511. I’ll update this post till the semester is over. Formatting R Code Reading code is pain, but the well-formatted code might alleviate the pain a little bit. The function tidy.source() in the animation package can help us format ... [Read more...]

Guess the Random Seed

March 12, 2010 | Yihui Xie

tephanie asked in 511 today if we were able to get the random seed which was set by set.seed() but we were only given the random numbers (without knowing the seed). This kind of “hacker” questions sound interesting. One dirty solution should be the brute-force method, e.g: # x: the ... [Read more...]

Press Enter in LyX Sweave as You Wish

February 18, 2010 | Yihui Xie

or a long time I’ve been wondering why we are not able to use Enter in the LyX Scrap environment which was set up by Gregor Gorjanc for Sweave. Two weeks ago, I (finally!) could not help asking Gregor about this issue, as I’m using “LyX + Sweave” more ...
[Read more...]
1 2 3 4

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)