<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: R-fanatic's Code Snippets</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Thu, 24 Jul 2008 17:46:13 GMT</pubDate>
    <description>DZone Snippets: R-fanatic's Code Snippets</description>
    <item>
      <title>create rotated axis labels</title>
      <link>http://snippets.dzone.com/posts/show/472</link>
      <description>The R FAQ states:&lt;br /&gt; &lt;br /&gt;&lt;code&gt;&lt;br /&gt;par(mar = c(7, 4, 4, 2) + 0.1)&lt;br /&gt;plot(1 : 30, xaxt = "n",  xlab = "")&lt;br /&gt;labels &lt;- paste("Label", 1:30, sep = " ")&lt;br /&gt;text(1:30, par("usr")[3] - 0.25, srt = 90, adj = 1,labels = labels, xpd = TRUE)&lt;br /&gt;mtext(1, text = "X Axis Label", line = 6)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Also see Figure 1 and associated code in Paul Murrell (2003), &#226;&#8364;&#339;Integrating grid Graphics Output with Base Graphics Output&#226;&#8364;?, R News, 3/2, 7&#226;&#8364;&#8220;12.</description>
      <pubDate>Sat, 09 Jul 2005 01:17:23 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/472</guid>
      <author>r-fanatic ()</author>
    </item>
    <item>
      <title>sort a data.frame by a given column</title>
      <link>http://snippets.dzone.com/posts/show/470</link>
      <description>&lt;code&gt;&lt;br /&gt;data &lt;- sort.data.frame(data, key = "LOC")&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;where the function "sort.data.frame" is as follows:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;sort.data.frame &lt;- function(x, key, ...) {&lt;br /&gt;    if (missing(key)) {&lt;br /&gt;        rn &lt;- rownames(x)&lt;br /&gt;        if (all(rn %in% 1:nrow(x))) rn &lt;- as.numeric(rn)&lt;br /&gt;        x[order(rn, ...), , drop=FALSE]&lt;br /&gt;    } else {&lt;br /&gt;        x[do.call("order", c(x[key], ...)), , drop=FALSE]&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 08 Jul 2005 20:14:56 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/470</guid>
      <author>r-fanatic ()</author>
    </item>
    <item>
      <title>barplot the lines of code by module</title>
      <link>http://snippets.dzone.com/posts/show/469</link>
      <description>The CSV file "loc.csv" contains the following:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Module LOC&lt;br /&gt;a.rb 100&lt;br /&gt;b.rb 120&lt;br /&gt;c.rb 54&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The following R code creates the barplot image "loc.png":&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;data &lt;- read.csv(file="loc.csv", sep = " ", header = TRUE, row.names = "Module")&lt;br /&gt;png("loc.png", width = 640, height = 480)&lt;br /&gt;barplot(data$LOC, names = rownames(data), ylim = c(0, 250), main = "Lines of code by module", ylab = "Lines of code", xlab = "Module")&lt;br /&gt;dev.off()&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 08 Jul 2005 20:10:06 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/469</guid>
      <author>r-fanatic ()</author>
    </item>
  </channel>
</rss>
