<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>R2S &#187; R语言</title> <atom:link href="http://www.road2stat.com/cn/tag/r%e8%af%ad%e8%a8%80/feed" rel="self" type="application/rss+xml" /><link>http://www.road2stat.com/cn</link> <description>江湖一散人</description> <lastBuildDate>Thu, 26 Jan 2012 08:18:36 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>结合豆瓣基础API学习XML包</title><link>http://www.road2stat.com/cn/r_language/rxml.html</link> <comments>http://www.road2stat.com/cn/r_language/rxml.html#comments</comments> <pubDate>Wed, 24 Aug 2011 06:37:00 +0000</pubDate> <dc:creator>Xiao Nan</dc:creator> <category><![CDATA[R]]></category> <category><![CDATA[API]]></category> <category><![CDATA[OAuth]]></category> <category><![CDATA[R语言]]></category> <category><![CDATA[XML]]></category> <category><![CDATA[笔记]]></category> <category><![CDATA[豆瓣]]></category><guid isPermaLink="false">http://www.road2stat.com/cn/?p=878</guid> <description><![CDATA[很久以前在R-Forge上注册过一个RDouban项目, 想用豆瓣提供的API做点好玩的事情. 可惜后来只写了个开头, 感兴趣的童鞋可以无条件认领. 在这里结合豆瓣的基础API, 非常简略地写一下用XML包读数据的基本问题. 1 XPath 花十分钟学习XPath语法. 熟练后可使用Firebug等调试工具直接提取. 此外, 要特别注意XML命名空间问题. (感谢yixuan提醒) 2 Douban API 花n分钟阅读"豆瓣API参考手册". 用户的评论、收藏、广播、豆邮等交互功能往往需要先进行OAuth认证, 建议阅读RFC5849以充分理解OAuth协议. 这块目前也有ROAuth包可以实现, 不过与读数据没什么关系, 此略. 3 Code 读取豆瓣电影/音乐/读书条目的API基本通用, 仅有部分字段细节的区别. 读数据时要注意缺失值和异常值的处理. 由于编码问题, 中文需要使用iconv()函数进行转码. 这里以读取一部电影的三个典型字段为例. 《僵尸肖恩》, IMDB编号tt0365748. require(XML) url = "http://api.douban.com/movie/subject/imdb/tt0365748" movieItemInfo = xmlTreeParse(url, useInternal &#8230; <a href="http://www.road2stat.com/cn/r_language/rxml.html">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>很久以前在R-Forge上注册过一个<a href="http://rdouban.r-forge.r-project.org/" target="_blank">RDouban项目</a>, 想用豆瓣提供的API做点好玩的事情. 可惜后来只写了个开头, 感兴趣的童鞋可以无条件认领. 在这里结合豆瓣的基础API, 非常简略地写一下用XML包读数据的基本问题.</p><h1>1 XPath</h1><p>花十分钟学习<a href="http://www.w3school.com.cn/xpath/index.asp" target="_blank">XPath</a>语法.<br /> 熟练后可使用Firebug等调试工具直接提取. 此外, 要特别注意<a href="http://www.w3school.com.cn/xml/xml_namespaces.asp" target="_blank">XML命名空间</a>问题. (感谢yixuan提醒)</p><h1>2 Douban API</h1><p>花n分钟阅读"<a href="http://www.douban.com/service/apidoc/reference/" target="_blank">豆瓣API参考手册</a>".<br /> 用户的评论、收藏、广播、豆邮等交互功能往往需要先进行OAuth认证, 建议阅读<a href="http://tools.ietf.org/html/rfc5849" target="_blank">RFC5849</a>以充分理解OAuth协议. 这块目前也有ROAuth包可以实现, 不过与读数据没什么关系, 此略.</p><p><span id="more-878"></span></p><h1>3 Code</h1><p>读取豆瓣电影/音乐/读书条目的API基本通用, 仅有部分字段细节的区别. 读数据时要注意缺失值和异常值的处理. 由于编码问题, 中文需要使用<code>iconv()</code>函数进行转码. 这里以读取一部电影的三个典型字段为例.</p><p>《僵尸肖恩》, IMDB编号tt0365748.</p><p><code>require(XML)<br /> url = "http://api.douban.com/movie/subject/imdb/tt0365748"<br /> movieItemInfo = xmlTreeParse(url, useInternal = TRUE)</code></p><p>名称:<br /> <code>iconv(xmlValue(getNodeSet(doc = movieItemInfo,<br /> path = "//db:attribute[@name='title']",<br /> namespaces = c("db" = "http://www.douban.com/xmlns/"))[[1]]),<br /> from = 'UTF-8', to = '')<br /> # [1] "Shaun of the Dead"</code></p><p>主演:<br /> <code>iconv(sapply(getNodeSet(doc = movieItemInfo,<br /> path = "//db:attribute[@name='cast']",<br /> namespaces = c("db" = "http://www.douban.com/xmlns/")), xmlValue),<br /> from = 'UTF-8', to = '')<br /> #  [1] "西蒙·佩吉"         "尼克·弗罗斯特"     "比尔·奈伊"<br /> #  [4] "凯特·阿什菲尔德"   "彼得·塞拉菲诺威茨" "迪兰·莫兰"<br /> #  [7] "露茜·戴维斯"       "尼古拉·坎宁安"     "基尔·米尔斯"<br /> # [10] "马特·杰恩斯"       "加文·弗格森"       "霍顿·朱庇特"<br /> # [13] "蒂姆·巴格雷"       "阿尔温德·多希"     "拉菲·斯波"<br /> # [16] "索奈尔·达卓" </code></p><p>标签名:<br /> <code>iconv(xpathApply(movieItemInfo,<br /> path = "//db:tag", xmlGetAttr, "name",<br /> namespaces = c("db" = "http://www.douban.com/xmlns/")),<br /> from = 'UTF-8', to = '')<br /> # [1] "黑色幽默"  "英国"      "喜剧"      "僵尸"      "英国电影"  "cult"<br /> # [7] "SimonPegg" "恐怖" </code></p><p>以上, 我们针对XML文档中不同形式的结构, 组合使用了<code>xmlValue()</code>, <code>getNodeSet()</code>, <code>xpathApply()</code>, <code>xmlGetAttr()</code>, <code>sapply()</code>几个函数. 这些, 基本就是XML包和豆瓣API的初阶. 要实现POST数据等等进阶功能, 不妨深入研读XML包的冗长文档.</p> ]]></content:encoded> <wfw:commentRss>http://www.road2stat.com/cn/r_language/rxml.html/feed</wfw:commentRss> <slash:comments>10</slash:comments> </item> <item><title>使用Google Perftools和kcachegrind深入剖析R程序性能瓶颈</title><link>http://www.road2stat.com/cn/r_language/rprofiling.html</link> <comments>http://www.road2stat.com/cn/r_language/rprofiling.html#comments</comments> <pubDate>Fri, 22 Jul 2011 22:20:38 +0000</pubDate> <dc:creator>Xiao Nan</dc:creator> <category><![CDATA[R]]></category> <category><![CDATA[Google]]></category> <category><![CDATA[kcachegrind]]></category> <category><![CDATA[Perftools]]></category> <category><![CDATA[profiling]]></category> <category><![CDATA[R语言]]></category> <category><![CDATA[valgrind]]></category> <category><![CDATA[剖析]]></category> <category><![CDATA[性能]]></category><guid isPermaLink="false">http://www.road2stat.com/cn/?p=816</guid> <description><![CDATA[“颐和园在我家北面，假如没有北这个方向的话，我就只好向南走，越过南极和北极，行程四万余公里到达那里。” ——《革命时期的爱情》 1 剖析与Profiling 这里的"剖析"对应的单词是"profiling", 中文似乎没有词语能精准地表达出原词的内涵, 与"shell"的情况有点类似, 所以就不去刻意翻译了. 由于没有学过软件工程, 不吝先贴一段wiki上profiling的定义[1]: In software engineering, program profiling, software profiling or simply profiling, a form of dynamic program analysis (as opposed to static code analysis), is the investigation of a program's behavior using &#8230; <a href="http://www.road2stat.com/cn/r_language/rprofiling.html">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<blockquote><p> “颐和园在我家北面，假如没有北这个方向的话，我就只好向南走，越过南极和北极，行程四万余公里到达那里。”</p><p style="text-align: right;" >——《革命时期的爱情》</p></blockquote><h1>1 剖析与Profiling</h1><p>这里的"剖析"对应的单词是"profiling", 中文似乎没有词语能精准地表达出原词的内涵, 与"shell"的情况有点类似, 所以就不去刻意翻译了. 由于没有学过软件工程, 不吝先贴一段wiki上profiling的定义[1]:</p><blockquote><p>In software engineering, program profiling, software profiling or simply profiling, a form of dynamic program analysis (as opposed to static code analysis), is the investigation of a program's behavior using information gathered as the program executes. The usual purpose of this analysis is to determine which sections of a program to optimize - to increase its overall speed, decrease its memory requirement or sometimes both.</p></blockquote><p>要提高R程序的运行速度, 不仅仅需要剽悍的机器(单核高频, 多核并行, GPU)和高效的代码(向量化, 混合编程), 寻找程序中的性能瓶颈并进行有针对的优化也是很重要的, "找到北这个方向", 就是profiling的意义所在.</p><p>R中其实自带了几个最简单的profiling工具, 我们或多或少都接触过:</p><ul><li><code>base::system.time()</code> —— 简陋的计时秒表</li><li><code>utils::Rprof()</code> —— 对CPU的简易profile工具</li><li><code>utils::Rprofmem()</code> —— 对内存的简易profile工具</li></ul><p>关于这些函数的使用, 可以参看Ross Ihaka的说明[2]. 与此同时, CRAN上<a href="http://cran.r-project.org/web/packages/profr/" target="_blank">profr</a>(Hadley Wickham)和<a href="http://cran.r-project.org/web/packages/proftools/" target="_blank">proftools</a>(Luke Tierney)两个微型包均提供了可视化<code>Rprof()</code>函数输出结果的能力. 但是, 这类简单的profiling只将程序拆解了到了单个R运算的层次, 没有提供更深一层, 即profiling compiled code的功能. R原生支持这个特性, 但需要在编译时对默认选项进行简单的修改[4].</p><h1>2 安装Google Perftools</h1><p>翻看Dirk Eddelbuettel牛在useR2010上的RhpcTutorial[3], 其中提到了Google员工开发的Google Perftools可以profiling compiled code. 试了一下, 感觉是个不错的工具, 配合kcachegrind, 还可以将结果可视化.</p><p>测试环境: Arch Linux x86_64</p><p>AUR上已有一位大人在维护google-perftools(源代码安装):</p><pre>sudo yaourt -S google-perftools</pre><p>Fedora:</p><pre>sudo yum install google-perftools</pre><p>Ubuntu:</p><pre>sudo apt-get install google-perftools</pre><p>不过Ubuntu/Fedora仓库中的二进制包可能比较陈旧了, 无妨直接自行编译最新版本:</p><pre>svn checkout http://google-perftools.googlecode.com/svn/trunk/</pre><p>在Arch x86_64下, google-perftools的默认安装路径为</p><pre>/usr/bin</pre><p>库文件libprofiler.so位于</p><pre>/usr/lib</pre><p>Google Perftools工具集中除了名为pprof的CPU profiler以外, 还提供了堆内存泄漏检测/使用情况统计等工具. 这里我们只关注pprof就可以了: 它通过CPU中断采样的方式统计每个函数被采样的次数, 占总采样次数的百分比, 调用的子函数的被采样次数等等(可以说"剖析"在此处还是比较恰当的). 最后通过这些信息寻找程序的(CPU)性能瓶颈.</p><h1>3 使用Google Perftools</h1><p>要和R一起使用, pprof有两种可行的运行方式, 第一种比较硬朗: 在编译选项中直接加入对libprofiler.so的引用, R在运行时就会自动加载libprofiler库:</p><div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p816code11'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p81611"><td class="code" id="p816code11"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>cran.r-project.org<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>base<span style="color: #000000; font-weight: bold;">/</span>R-<span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">/</span>R-2.13.1.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xf</span> R-2.13.1.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> R-2.13.1
&nbsp;
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">MAIN_CFLAGS</span>=<span style="color: #ff0000;">&quot;-pg&quot;</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">MAIN_FFLAGS</span>=<span style="color: #ff0000;">&quot;-pg&quot;</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">MAIN_LDFLAGS</span>=<span style="color: #ff0000;">&quot;-pg&quot;</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">LDFLAGS</span>=<span style="color: #ff0000;">&quot;-lprofiler&quot;</span>
<span style="color: #666666; font-style: italic;"># 也可显式指定路径:</span>
<span style="color: #666666; font-style: italic;"># export LDFLAGS=&quot;-L/usr/lib -lprofiler&quot;</span>
.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--enable-R-shlib</span></pre></td></tr></table></div><p>参数 -pg 打开R的profiling支持, 设定LDFLAGS用以连接libprofiler库.</p><p>configure完成:</p><pre>R is now configured for x86_64-unknown-linux-gnu

  Source directory:          .
  Installation directory:    /usr/local

  C compiler:                gcc -std=gnu99  -g -O2
  Fortran 77 compiler:       gfortran  -g -O2

  C++ compiler:              g++  -g -O2
  Fortran 90/95 compiler:    gfortran -g -O2
  Obj-C compiler:	      

  Interfaces supported:      X11
  External libraries:        readline, ICU, lzma
  Additional capabilities:   PNG, JPEG, TIFF, NLS, cairo
  Options enabled:           shared R library, shared BLAS, R profiling, Java

  Recommended packages:      yes</pre><p>结果无误, 开始编译安装:</p><div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p816code12'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p81612"><td class="code" id="p816code12"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></td></tr></table></div><p>这样, 连接了libprofiler.so的R编译成功.</p><p>第二种使用pprof的方式则相对委婉: 使用时动态预加载库文件就可以了, Dirk大人的RhpcTutorial中已经给出说明, 此略.</p><p>选取《Wringting R Extension》 3.2节中给出的一个例子进行测试:</p><div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.road2stat.com/cn/wp-content/plugins/wp-codebox/wp-codebox.php?p=816&amp;download=profiling.R">profiling.R</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p81613"><td class="code" id="p816code13"><pre class="rsplus" style="font-family:monospace;"><span style="color: #228B22;">#!/usr/local/lib64/R/bin/Rscript</span>
<a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/suppressMessages.html"><span style="color: #0000FF; font-weight: bold;">suppressMessages</span></a><span style="color: #080;">&#40;</span><a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/library.html"><span style="color: #0000FF; font-weight: bold;">library</span></a><span style="color: #080;">&#40;</span>MASS<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
<a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/suppressMessages.html"><span style="color: #0000FF; font-weight: bold;">suppressMessages</span></a><span style="color: #080;">&#40;</span><a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/library.html"><span style="color: #0000FF; font-weight: bold;">library</span></a><span style="color: #080;">&#40;</span>boot<span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
storm.<span style="">fm</span> <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">nls</span><span style="color: #080;">&#40;</span>Time ~ b<span style="color: #080;">*</span>Viscosity<span style="color: #080;">/</span><span style="color: #080;">&#40;</span>Wt <span style="color: #080;">-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/c.html"><span style="color: #0000FF; font-weight: bold;">c</span></a><span style="color: #080;">&#41;</span>, stormer, 
                <span style="color: #0000FF; font-weight: bold;">start</span> <span style="color: #080;">=</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/c.html"><span style="color: #0000FF; font-weight: bold;">c</span></a><span style="color: #080;">&#40;</span>b<span style="color: #080;">=</span><span style="color: #ff0000;">29.401</span>, <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/c.html"><span style="color: #0000FF; font-weight: bold;">c</span></a><span style="color: #080;">=</span><span style="color: #ff0000;">2.2183</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
st <span style="color: #080;">&lt;-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/cbind.html"><span style="color: #0000FF; font-weight: bold;">cbind</span></a><span style="color: #080;">&#40;</span>stormer, fit<span style="color: #080;">=</span><span style="color: #0000FF; font-weight: bold;">fitted</span><span style="color: #080;">&#40;</span>storm.<span style="">fm</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
storm.<span style="">bf</span> <span style="color: #080;">&lt;-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/function.html"><span style="color: #0000FF; font-weight: bold;">function</span></a><span style="color: #080;">&#40;</span>rs, i<span style="color: #080;">&#41;</span> <span style="color: #080;">&#123;</span>
    st$Time <span style="color: #080;">&lt;-</span>  st$fit <span style="color: #080;">+</span> rs<span style="color: #080;">&#91;</span>i<span style="color: #080;">&#93;</span>
    tmp <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">nls</span><span style="color: #080;">&#40;</span>Time ~ <span style="color: #080;">&#40;</span>b <span style="color: #080;">*</span> Viscosity<span style="color: #080;">&#41;</span><span style="color: #080;">/</span><span style="color: #080;">&#40;</span>Wt <span style="color: #080;">-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/c.html"><span style="color: #0000FF; font-weight: bold;">c</span></a><span style="color: #080;">&#41;</span>, st, <span style="color: #0000FF; font-weight: bold;">start</span> <span style="color: #080;">=</span> <span style="color: #0000FF; font-weight: bold;">coef</span><span style="color: #080;">&#40;</span>storm.<span style="">fm</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>
    tmp$m$getAllPars<span style="color: #080;">&#40;</span><span style="color: #080;">&#41;</span>
<span style="color: #080;">&#125;</span>
rs <span style="color: #080;">&lt;-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/scale.html"><span style="color: #0000FF; font-weight: bold;">scale</span></a><span style="color: #080;">&#40;</span><span style="color: #0000FF; font-weight: bold;">resid</span><span style="color: #080;">&#40;</span>storm.<span style="">fm</span><span style="color: #080;">&#41;</span>, <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/scale.html"><span style="color: #0000FF; font-weight: bold;">scale</span></a> <span style="color: #080;">=</span> FALSE<span style="color: #080;">&#41;</span>
storm.<span style="">boot</span> <span style="color: #080;">&lt;-</span> boot<span style="color: #080;">&#40;</span>rs, storm.<span style="">bf</span>, R <span style="color: #080;">=</span> <span style="color: #ff0000;">500</span><span style="color: #080;">&#41;</span></pre></td></tr></table></div><p>将profiling结果记录到文件:</p><div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p816code14'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p81614"><td class="code" id="p816code14"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">755</span> profiling.R
<span style="color: #007800;">CPUPROFILE</span>=rprof.out .<span style="color: #000000; font-weight: bold;">/</span>profiling.R</pre></td></tr></table></div><p>这里在写R文件时用了一点点技巧, 使得它能够支持类Unix系统的Shebang特性而直接执行, 参考[7], [8].</p><p>执行完毕后, 我们即可使用pprof来分析输出的结果文件(一个二进制文件！)了. pprof可以将此文件解析成你想要的各种可读的形式. 其参数如下:</p><pre>pprof --option [ --focus=< regexp > ] [ --ignore=< regexp > ]
                      [--line or addresses or functions] 可执行文件路径 结果文件路径
</pre><p>方括号为可选项目, <code>< regexp ></code>为正则表达式.</p><p>具体的选项分为几组. 其中输出格式的基本可选项为:</p><pre>text, callgrind, gv, evince, web, symbols, dot, ps, pdf, svg, gif, raw, list=< regexp >, disasm=< regexp >.</pre><p><code>text</code> 表示字符统计输出形式, 其它均对应各自的图形格式;<br /> <code>list=< regexp ></code> 表示输出匹配正则表达式的函数的源代码;<br /> <code>diasm=< regexp ></code> 表示输出匹配正则表达式的函数的反汇编代码.</p><p>其他比较重要的参数:</p><p><code>--focus=< regexp ></code> 表示只统计函数名匹配正则表达式的函数的采样;<br /> <code>--ignore=< regexp ></code> 表示不统计函数名匹配正则表达式的函数的采样;<br /> <code>[--line or addresses or functions]</code> 表示生成的统计是基于代码行, 指令地址还是函数的, 默认是函数.</p><p>这里仅输出文字型结果:</p><div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p816code15'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p81615"><td class="code" id="p816code15"><pre class="bash" style="font-family:monospace;">pprof <span style="color: #660033;">--cum</span> <span style="color: #660033;">--text</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib64<span style="color: #000000; font-weight: bold;">/</span>R<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>Rscript rprof.out <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">less</span></pre></td></tr></table></div><p>结果中的前15位:</p><pre>
Total: 254 samples
       2   0.8%   0.8%      213  83.9% Rf_applyClosure
      24   9.4%  10.2%      213  83.9% Rf_eval
       0   0.0%  10.2%      213  83.9% do_begin
       0   0.0%  10.2%      212  83.5% do_set
       0   0.0%  10.2%      206  81.1% do_internal
       0   0.0%  10.2%      148  58.3% do_lapply
       7   2.8%  13.0%      123  48.4% Rf_evalList
       0   0.0%  13.0%      107  42.1% Rf_ReplIteration
       0   0.0%  13.0%      104  40.9% R_ReplConsole
       0   0.0%  13.0%      102  40.2% Rf_usemethod
       0   0.0%  13.0%      100  39.4% run_Rmainloop
       0   0.0%  13.0%       96  37.8% main
       0   0.0%  13.0%       92  36.2% __libc_start_main
       0   0.0%  13.0%       85  33.5% do_usemethod
       1   0.4%  13.4%       85  33.5% forcePromise
</pre><p>输出结果中, 每行对应着一个函数的统计:</p><ul><li>第1, 2列是该函数的本地采样(不包括被该函数调用的函数中的采样次数)次数和比例;</li><li>第3列是该函数本地采样次数占当前所有已统计函数的采样次数之和的比例;</li><li>第4, 5列是该函数的累计采样次数(包括其调用的函数中的采样次数)和比例.</li></ul><p>如果你的系统中安装了gnu-gv或evince, 即可直接即刻显示一幅无码清晰大图(ps/pdf):</p><div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p816code16'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p81616"><td class="code" id="p816code16"><pre class="bash" style="font-family:monospace;">pprof <span style="color: #660033;">--gv</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib64<span style="color: #000000; font-weight: bold;">/</span>R<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>Rscript rprof.out
pprof <span style="color: #660033;">--evince</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib64<span style="color: #000000; font-weight: bold;">/</span>R<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>Rscript rprof.out</pre></td></tr></table></div><p><a href="http://www.road2stat.com/cn/wp-content/attachments/2011/07/rprof.gif"><img src="http://www.road2stat.com/cn/wp-content/attachments/2011/07/rprof-300x182.gif" alt="rprof" title="rprof" width="300" height="182" class="aligncenter size-medium wp-image-817" /></a></p><p>其他几个比较常用的选项可能是</p><p>生成PDF:</p><div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p816code17'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p81617"><td class="code" id="p816code17"><pre class="bash" style="font-family:monospace;">pprof <span style="color: #660033;">--pdf</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib64<span style="color: #000000; font-weight: bold;">/</span>R<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>Rscript rprof.out <span style="color: #000000; font-weight: bold;">&gt;</span> rprof.pdf</pre></td></tr></table></div><p>生成SVG:</p><div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p816code18'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p81618"><td class="code" id="p816code18"><pre class="bash" style="font-family:monospace;">pprof <span style="color: #660033;">--svg</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib64<span style="color: #000000; font-weight: bold;">/</span>R<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>Rscript rprof.out <span style="color: #000000; font-weight: bold;">&gt;</span> rprof.svg</pre></td></tr></table></div><p>生成GraphViz所支持的dot格式:</p><div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p816code19'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p81619"><td class="code" id="p816code19"><pre class="bash" style="font-family:monospace;">pprof <span style="color: #660033;">--dot</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib64<span style="color: #000000; font-weight: bold;">/</span>R<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>Rscript rprof.out <span style="color: #000000; font-weight: bold;">&gt;</span> rprof.dot</pre></td></tr></table></div><p>当然, 要想读懂图中的内容, 从而针对某些部分进行优化, 还需要对R的底层比较熟悉才行: 最起码要了解涉及到的C函数的具体功能.</p><h1>4 配合kcachegrind可视化profile结果</h1><p>pprof可将输出转化为强大的Valgrind工具集中的组件Callgrind可采用的格式, 配合KCachegrind这个图形前端, 即可对结果进行简单的可视化, 能够交互哦亲:</p><div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p816code20'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p81620"><td class="code" id="p816code20"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># For Arch Linux</span>
<span style="color: #666666; font-style: italic;"># sudo pacman -S kdesdk-kcachegrind</span>
pprof <span style="color: #660033;">--callgrind</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib64<span style="color: #000000; font-weight: bold;">/</span>R<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>Rscript rprof.out <span style="color: #000000; font-weight: bold;">&gt;</span> rprof.callgrind
kcachegrind rprof.callgrind</pre></td></tr></table></div><p><a href="http://www.road2stat.com/cn/wp-content/attachments/2011/07/kcachegrind.jpg"><img src="http://www.road2stat.com/cn/wp-content/attachments/2011/07/kcachegrind-300x198.jpg" alt="kcachegrind" title="kcachegrind" width="300" height="198" class="aligncenter size-medium wp-image-818" /></a></p><p>其实看上去KCachegrid就是做了一个最普通的树可视化, 所以理论上我们其实可以用角度各异的无数种手段展示profiling结果: 就是画一棵树嘛. 不过KCachegrind中可以与图形交互, 进一步的分析很方便, 大家可以自己进一步体验.</p><h1>5 其他工具(sprof和oprofile)</h1><p>Writing R Extensions[6]提到另外两个可供Linuxer选择的工具: sprof和oprofile, 我没有实验, 感兴趣的同学不妨实践一下.</p><h1>6 参考</h1><p>[1] <a href="http://en.wikipedia.org/wiki/Profiling_(computer_programming)" target="_blank">Wikipedia - Profiling (computer programming)</a>.<br /> [2] Ross Ihaka. <a href="http://www.stat.auckland.ac.nz/~ihaka/downloads/Taupo.pdf" target="_blank">Writing Efficient Programs in R (and Beyond)</a>.<br /> [3] Dirk Eddelbuettel. <a href="http://dirk.eddelbuettel.com/papers/useR2010hpcTutorial.pdf" target="_blank">Introduction to High-Performance Computing with R</a>. pp. 29-35<br /> [4] R Installation and Administration. Version 2.13.0 (2011-04-13) Appendix B.1, B.7.<br /> [5] 冯文龙. <a href="http://www.ibm.com/developerworks/cn/linux/l-cn-googleperf/index.html" target="_blank">使用google-perftools剖析程序性能瓶颈</a>.<br /> [6] Writing R Extensions. Version 2.13.0 (2011-04-13) pp. 69-71.<br /> [7] <a href="http://zh.wikipedia.org/wiki/Shebang" target="_blank">Wikipedia - Shebang</a>.<br /> [8] <a href="http://stackoverflow.com/questions/3128122/shebang-line-not-working-in-r-script" target="_blank">shebang line not working in R script</a>.</p> ]]></content:encoded> <wfw:commentRss>http://www.road2stat.com/cn/r_language/rprofiling.html/feed</wfw:commentRss> <slash:comments>6</slash:comments> </item> <item><title>小径分岔的花园</title><link>http://www.road2stat.com/cn/r_language/visual_earthquakes.html</link> <comments>http://www.road2stat.com/cn/r_language/visual_earthquakes.html#comments</comments> <pubDate>Sun, 25 Apr 2010 00:38:07 +0000</pubDate> <dc:creator>Xiao Nan</dc:creator> <category><![CDATA[R]]></category> <category><![CDATA[RgoogleMaps]]></category> <category><![CDATA[R语言]]></category> <category><![CDATA[卫星地图]]></category> <category><![CDATA[可视化]]></category> <category><![CDATA[地震]]></category> <category><![CDATA[震源]]></category> <category><![CDATA[震级]]></category> <category><![CDATA[高维数据]]></category><guid isPermaLink="false">http://www.road2stat.com/cn/?p=457</guid> <description><![CDATA[前天晚上发出一篇质量平平的博文后, 太云学长提出一个建议(其实算是中肯的批评): 用点的大小表示震级的大小. 其实以前也不是没想过这个问题. 只是不怎么懂R中的向量操作, 加上自己比较懒, 所以就 ... 昨天没去教室学习(极度堕落啊), 正好宅在寝室里没事, 就画出来玩玩. 我们首先绘制图1, 点的半径大小代表震级的高低. 点的半径越大, 震级越高. (数据附文后) 然后绘制图2, 点的透明度高低代表震源的深度, 点的透明度越靠近完全不透明 (完全不透明的红色为#FF0000FF), 表示震源深度越浅. 绘制图3, 点的半径大小表示震级的大小, 各点颜色透明度的不同表示震源的深度. 事实上, 三张图的区别极小, 区别就在于绘图参数中bg和cex两个参数的不同. 值得注意的是, 我发现, 使用透明度区分颜色(震源深度)而不是使用纯粹的渐变色(如黄色到红色)区分颜色的一个特点是, 点在叠加的部分会显示得更“深”更“亮”, 在颜色上的体现也就是更加的不透明. 如果你的显示器性能足够强悍, 对比度足够高, 那么可能相对分辨得比较清楚(虽然硬件因素在这个特例中不是很重要, 但这个特性的确是与硬件有一定关系的). 如果效果不是特别明显, 你仍然可以尝试调整一下显示器和眼睛的角度: 将(笔记本的)显示器放得非常平(几乎与视线平行). 你会发现, &#8230; <a href="http://www.road2stat.com/cn/r_language/visual_earthquakes.html">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>前天晚上发出一篇质量平平的博文后, 太云学长提出一个建议(其实算是中肯的批评): 用点的大小表示震级的大小. 其实以前也不是没想过这个问题. 只是不怎么懂R中的向量操作, 加上自己比较懒, 所以就 ... 昨天没去教室学习(极度堕落啊), 正好宅在寝室里没事, 就画出来玩玩.</p><p>我们首先绘制图1, 点的半径大小代表震级的高低. 点的半径越大, 震级越高. (数据附文后)</p><div id="attachment_458" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.road2stat.com/cn/attachments/2010/04/ms.png"><img class="size-medium wp-image-458" title="图1 震级的大小" src="http://www.road2stat.com/cn/attachments/2010/04/ms-300x299.png" alt="图1 震级的大小" width="300" height="299" /></a><p class="wp-caption-text">图1 震级的大小</p></div><p>然后绘制图2, 点的透明度高低代表震源的深度, 点的透明度越靠近完全不透明 (完全不透明的红色为#FF0000FF), 表示震源深度越浅.</p><p><div id="attachment_459" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.road2stat.com/cn/attachments/2010/04/depth.png"><img class="size-medium wp-image-459" title="图2 震源的深度" src="http://www.road2stat.com/cn/attachments/2010/04/depth-300x299.png" alt="图2 震源的深度" width="300" height="299" /></a><p class="wp-caption-text">图2 震源的深度</p></div><span id="more-457"></span><br /> 绘制图3, 点的半径大小表示震级的大小, 各点颜色透明度的不同表示震源的深度.</p><p>事实上, 三张图的区别极小, 区别就在于绘图参数中bg和cex两个参数的不同.</p><div id="attachment_460" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.road2stat.com/cn/attachments/2010/04/hybrid.png"><img class="size-medium wp-image-460" title="图3 震级的大小及震源的深度" src="http://www.road2stat.com/cn/attachments/2010/04/hybrid-300x299.png" alt="图3 震级的大小及震源的深度" width="300" height="299" /></a><p class="wp-caption-text">图3 震级的大小及震源的深度</p></div><p>值得注意的是, 我发现, 使用透明度区分颜色(震源深度)而不是使用纯粹的渐变色(如黄色到红色)区分颜色的一个特点是, 点在叠加的部分会显示得更“深”更“亮”, 在颜色上的体现也就是更加的不透明. 如果你的显示器性能足够强悍, 对比度足够高, 那么可能相对分辨得比较清楚(虽然硬件因素在这个特例中不是很重要, 但这个特性的确是与硬件有一定关系的). 如果效果不是特别明显, 你仍然可以尝试调整一下显示器和眼睛的角度: 将(笔记本的)显示器放得非常平(几乎与视线平行). 你会发现, 其他点都已经变得与底色区别不大的时候, 图3正中偏左下部分(即青海玉树地区)以及一些有叠加的地区呈现一种更深的黑色. 而且, 这种性质与有叠加区域所在的图中位置, 即人们具体视角的关系很小, 不信你可以把图3上下部分互换一下. 至于叠加会产生这种效果的深层次原因, 我想应该是对应着一个光学上的某种简单原理(应该早有人提出了), 但是具体的原理如何表达, 我不得而知, 不过我猜想应该是透明度(alpha)有一种可以累加的性质吧.</p><p>当然, 这种不同透明度的叠加几乎没有什么意义, 因为两次不同地震的震源深度数据相加是没有什么意义的. 最多能够给人们一个大致的印象, 那就是哪里的地震发生比较频繁. 当然, 如果你愿意的话, 也可以理解成, 同一个地方发生了那么多次地震, 以破坏力累计, 相当于震源深度越来越浅了.</p><p>抛开叠加的因素, 以颜色的透明度区分单独看起来还有点意义, 那就是震源深度浅(透明度较低), 破坏性强的地震将更吸引眼球, 换个最贴切的词就是更Significant一些.</p><p>我们说, 如果有这样一个数据集, 满足: 1. 能够稍微让点在空间上散开一些, 至少让我们可以较好地区分开不同的点; 2. 透明度不同的颜色序列的间隔再大一些, 也就是不同透明度之间的区别更明显一些, 那么使用这种透明度的渐变我觉得可能还是有点意思的.</p><p>我的另外一个观点是, 从根本上讲, 很遗憾, 虽然不能算是严重的误导, 但这种点的大小和颜色的区别并不能够让我们产生完全理性的认识, 而最多只能算是一种示意和参考. 也就是说, 这种表示方法本身就是有问题的. 我们知道, 震级的表示是取了对数的, 也就是说, 震级每增长一级, 释放的能量将增长超过一个数量级, 约为上一级释放能量的30多倍. 图中并没有一个量能够完美地体现这一点, 让人更无奈的是, 我觉得人们对点的半径大小和面积的感知可能还存在着敏感与不敏感的问题等等. 由于我实在是不懂可视化, 就不再继续痴人说梦了.</p><h3>附</h3><p><a href="http://www.road2stat.com/cn/attachments/2010/04/data.zip">点击下载文中使用的数据</a></p><h4>附1. 数据说明</h4><p>数据条目: 354</p><p>时间跨度: 2010年3月23日-4月23日</p><p>经纬度范围: 31°-39°N, 94°-103°E</p><p>震源深度单位: Km</p><p>震级度量: <strong>面波震级Ms</strong></p><p>数据来源: <a href="http://data.earthquake.cn/" target="_blank">国家地震数据共享中心</a></p><p>为了可以直接执行下面的R命令, 解压后, 将<em>data.csv</em>放入R的工作目录. 这个目录在Windows环境下一般是:</p><p><em>X:Documents and SettingsYour User NameMy Documents</em></p><h4>附2. 绘图过程</h4><div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.road2stat.com/cn/wp-content/plugins/wp-codebox/wp-codebox.php?p=457&amp;download=Vis_EQ.R">Vis_EQ.R</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p45723"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
</pre></td><td class="code" id="p457code23"><pre class="rsplus" style="font-family:monospace;"><span style="color: #228B22;"># Required Packages:</span>
<span style="color: #228B22;"># sp/rgdal/RgoogleMaps</span>
<span style="color: #228B22;"># Data Proc.</span>
markerdata <span style="color: #080;">&lt;-</span> <span style="color: #0000FF; font-weight: bold;">read.<span style="">csv</span></span><span style="color: #080;">&#40;</span><span style="color: #ff0000;">&quot;data.csv&quot;</span><span style="color: #080;">&#41;</span>
boundingbox <span style="color: #080;">&lt;-</span> qbbox<span style="color: #080;">&#40;</span>lon <span style="color: #080;">=</span> markerdata<span style="color: #080;">&#91;</span>, <span style="color: #ff0000;">&quot;lon&quot;</span><span style="color: #080;">&#93;</span>, lat <span style="color: #080;">=</span> markerdata<span style="color: #080;">&#91;</span>,
    <span style="color: #ff0000;">&quot;lat&quot;</span><span style="color: #080;">&#93;</span><span style="color: #080;">&#41;</span>
EQMap <span style="color: #080;">&lt;-</span> GetMap.<span style="">bbox</span><span style="color: #080;">&#40;</span>boundingbox$lonR, boundingbox$latR,
    destfile <span style="color: #080;">=</span> <span style="color: #ff0000;">&quot;EQ.png&quot;</span>, maptype <span style="color: #080;">=</span> <span style="color: #ff0000;">&quot;satellite&quot;</span>, zoom <span style="color: #080;">=</span> <span style="color: #ff0000;">6</span><span style="color: #080;">&#41;</span>
dep <span style="color: #080;">&lt;-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/as.vector.html"><span style="color: #0000FF; font-weight: bold;">as.<span style="">vector</span></span></a><span style="color: #080;">&#40;</span>markerdata$dep<span style="color: #080;">&#41;</span>
<span style="color: #228B22;"># Plot begin</span>
<span style="color: #228B22;"># Radius = Ms</span>
result1 <span style="color: #080;">&lt;-</span> PlotOnStaticMap<span style="color: #080;">&#40;</span>EQMap, lon <span style="color: #080;">=</span> markerdata$lon,
    lat <span style="color: #080;">=</span> markerdata$lat, pch <span style="color: #080;">=</span> <span style="color: #ff0000;">21</span>, bg <span style="color: #080;">=</span> <span style="color: #ff0000;">&quot;red&quot;</span>, cex <span style="color: #080;">=</span> markerdata$ms,
    <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/col.html"><span style="color: #0000FF; font-weight: bold;">col</span></a> <span style="color: #080;">=</span> <span style="color: #ff0000;">&quot;black&quot;</span>, verbose <span style="color: #080;">=</span> <span style="color: #ff0000;">0</span><span style="color: #080;">&#41;</span>
<a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/Sys.sleep.html"><span style="color: #0000FF; font-weight: bold;">Sys.<span style="">sleep</span></span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">3</span><span style="color: #080;">&#41;</span>
<span style="color: #228B22;"># Color = Depth</span>
result2 <span style="color: #080;">&lt;-</span> PlotOnStaticMap<span style="color: #080;">&#40;</span>EQMap, lon <span style="color: #080;">=</span> markerdata$lon,
    lat <span style="color: #080;">=</span> markerdata$lat, pch <span style="color: #080;">=</span> <span style="color: #ff0000;">21</span>, bg <span style="color: #080;">=</span> dep, cex <span style="color: #080;">=</span> <span style="color: #ff0000;">1</span>, <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/col.html"><span style="color: #0000FF; font-weight: bold;">col</span></a> <span style="color: #080;">=</span> <span style="color: #ff0000;">&quot;black&quot;</span>,
    verbose <span style="color: #080;">=</span> <span style="color: #ff0000;">0</span><span style="color: #080;">&#41;</span>
<a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/Sys.sleep.html"><span style="color: #0000FF; font-weight: bold;">Sys.<span style="">sleep</span></span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">3</span><span style="color: #080;">&#41;</span>
<span style="color: #228B22;"># Fig 1/2 Hybrid</span>
result3 <span style="color: #080;">&lt;-</span> PlotOnStaticMap<span style="color: #080;">&#40;</span>EQMap, lon <span style="color: #080;">=</span> markerdata$lon,
    lat <span style="color: #080;">=</span> markerdata$lat, pch <span style="color: #080;">=</span> <span style="color: #ff0000;">21</span>, bg <span style="color: #080;">=</span> dep, cex <span style="color: #080;">=</span> markerdata$ms,
    <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/col.html"><span style="color: #0000FF; font-weight: bold;">col</span></a> <span style="color: #080;">=</span> <span style="color: #ff0000;">&quot;black&quot;</span>, verbose <span style="color: #080;">=</span> <span style="color: #ff0000;">0</span><span style="color: #080;">&#41;</span>
<span style="color: #228B22;"># End</span></pre></td></tr></table></div><h4>附3. 颜色透明度使用的简要说明</h4><p>观察数据得震源最大深度25km, 最小深度1km. 生成一个长度为25的向量, 最小值15, 最大值255. 以此向量作为rgb()函数的参数alpha(透明度), R=255, G=0, B=0.</p><p>在R中生成上述颜色:</p><div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.road2stat.com/cn/wp-content/plugins/wp-codebox/wp-codebox.php?p=457&amp;download=Alpha.R">Alpha.R</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p45724"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p457code24"><pre class="rsplus" style="font-family:monospace;">alpha <span style="color: #080;">&lt;-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/graphics/html/seq.html"><span style="color: #0000FF; font-weight: bold;">seq</span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">15</span>, <span style="color: #ff0000;">255</span>, <span style="color: #ff0000;">10</span><span style="color: #080;">&#41;</span>
x <span style="color: #080;">&lt;-</span> <a href="http://astrostatistics.psu.edu/su07/R/html/stats/html/summary.lm.html"><span style="color: #0000FF; font-weight: bold;">rgb</span></a><span style="color: #080;">&#40;</span><span style="color: #ff0000;">255</span>, <span style="color: #ff0000;">0</span>, <span style="color: #ff0000;">0</span>, alpha, maxColorValue<span style="color: #080;">=</span><span style="color: #ff0000;">255</span><span style="color: #080;">&#41;</span></pre></td></tr></table></div><p>向量x中存储了25种颜色的16进制表示(每个元素大致是"#FF00000F"这样的形式). 我们得到的25种颜色如图4所示.</p><div id="attachment_462" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.road2stat.com/cn/attachments/2010/04/red_alpha_changing.png"><img class="size-medium wp-image-462" title="图4 alpha值不同的25种红色" src="http://www.road2stat.com/cn/attachments/2010/04/red_alpha_changing-300x294.png" alt="图4 alpha值不同的25种红色" width="300" height="294" /></a><p class="wp-caption-text">图4 alpha值不同的25种红色</p></div><p>这里提一句, 点的缩放参数cex直接使用了Ms震级数据, 在其他图中为了看得更清楚或许需要做一个线性变换, 我觉得在这张图里直接用震级数据作为参数cex就差不多了.</p><p>我不懂数据框和向量操作, 所以直接将生成的颜色向量换入了上面的数据, 你可以通过代码实现. 最后解释一下标题, 其实标题本身是没有什么意义的, 《小径分岔的花园》是博尔赫斯的一个短篇, 代表了我的R绘图零基础在昨天做图时的蜿蜒曲折和无语之极 ..</p> ]]></content:encoded> <wfw:commentRss>http://www.road2stat.com/cn/r_language/visual_earthquakes.html/feed</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>R环境安全特性初探与前瞻，这次R语言会议的slides</title><link>http://www.road2stat.com/cn/r_language/r_security_slides.html</link> <comments>http://www.road2stat.com/cn/r_language/r_security_slides.html#comments</comments> <pubDate>Mon, 25 Jan 2010 17:53:02 +0000</pubDate> <dc:creator>Xiao Nan</dc:creator> <category><![CDATA[R]]></category> <category><![CDATA[R语言]]></category> <category><![CDATA[slides]]></category> <category><![CDATA[初探]]></category> <category><![CDATA[前瞻]]></category> <category><![CDATA[安全]]></category><guid isPermaLink="false">http://www.road2stat.com/cn/?p=323</guid> <description><![CDATA[汗啊，过了1个多月才放上来，从会场赶回学校以后一忙就把这事儿忘到九霄云外了，假期都到家了才想起来，真是对不住大伙了 .. 其实之前在COS主站上有发，只是那个版本稍旧，是在北京会场时使用的，此版本为上海会场使用的最终版，有一些增补和删改。没有太云学长和陈丽云学姐他们用Beamer精心制作的slides那么优雅飘逸，俺用Office 2010 Beta做的，不知字够不够大，希望大家能看清楚吧。 R环境安全特性初探与前瞻 (PDF, 2.95MB) 此文档遵循CC3.0，不过这里要特殊说明一下： 此文档仅为单纯的技术分析，任何个人或机构根据本文内容实施的任何行为，以及带来的任何经济损失、法律争议和相关后果，作者概不承担任何责任。 至于对应的paper，其实在去年11月份的时候就“凑”得差不多了，在这里偷个懒，就不发了。 感谢大家的关注和支持，小弟在此谢过。]]></description> <content:encoded><![CDATA[<p>汗啊，过了1个多月才放上来，从会场赶回学校以后一忙就把这事儿忘到九霄云外了，假期都到家了才想起来，真是对不住大伙了 ..</p><p>其实之前在COS主站上<a href="http://cos.name/2009/12/2nd-chinese-r-conference-summary/" target="_blank">有发</a>，只是那个版本稍旧，是在北京会场时使用的，此版本为上海会场使用的最终版，有一些增补和删改。没有<a href="http://taiyun.cos.name/" target="_blank">太云学长</a>和<a href="http://www.loyhome.cn/" target="_blank">陈丽云学姐</a>他们用Beamer精心制作的slides那么优雅飘逸，俺用Office 2010 Beta做的，不知字够不够大，希望大家能看清楚吧。</p><p><a href="http://www.road2stat.com/cn/attachments/2010/01/xiaonan-r-security-presentation-12-12-09.pdf">R环境安全特性初探与前瞻 (PDF, 2.95MB)</a></p><p>此文档遵循CC3.0，不过这里要特殊说明一下：</p><p><strong>此文档仅为单纯的技术分析，任何个人或机构根据本文内容实施的任何行为，以及带来的任何经济损失、法律争议和相关后果，作者概不承担任何责任。</strong></p><p>至于对应的paper，其实在去年11月份的时候就“凑”得差不多了，在这里偷个懒，就不发了。</p><p>感谢大家的关注和支持，小弟在此谢过。</p> ]]></content:encoded> <wfw:commentRss>http://www.road2stat.com/cn/r_language/r_security_slides.html/feed</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>第二届中国R语言会议 Dec 12-13, 2009 @ ECNU</title><link>http://www.road2stat.com/cn/r_language/2009_user_china_shanghai.html</link> <comments>http://www.road2stat.com/cn/r_language/2009_user_china_shanghai.html#comments</comments> <pubDate>Wed, 16 Dec 2009 18:01:18 +0000</pubDate> <dc:creator>Xiao Nan</dc:creator> <category><![CDATA[R]]></category> <category><![CDATA[2009]]></category> <category><![CDATA[R语言]]></category> <category><![CDATA[useR]]></category> <category><![CDATA[Vision]]></category> <category><![CDATA[会议]]></category> <category><![CDATA[华东师范大学]]></category> <category><![CDATA[青年视觉]]></category><guid isPermaLink="false">http://www.road2stat.com/cn/?p=229</guid> <description><![CDATA[写完才发现自己原来用了纯粹的倒叙。 关于记录，请看这位学姐的博文。已经写得很好了。 唯一的遗憾是这次没能和贝吉塔道别。劝君更尽一杯酒，天下谁人不识君（姊妹篇是这句：垂死病中惊坐起，笑问客从何处来）。 当然，这位有为青年想去延安西路331号的想法没有实现，是我的错，没有事先打探好地点，转而去看了军刀和金茂 .. 吴江路上的吉野家、生煎、炖汤、朗姆酒、冰淇淋 … Taiyun用典“饕餮”形容我们三个学弟让人发指的FB行径，此言不虚。 One Night in Shanghai。此行意外收获了一本《VISION》，周五初到沪上，路过华师附近的一个书报亭，我好奇的问了一句有没有《青年视觉》，没想到阿姨很爽快的说有，城市之间的差距啊 .. 当然，接下来就是四十两银子华丽的杯具 .. 由vision一词，我联想到北大数院的陈大岳教授在写给学生的话中，也曾经讲过关于“vision”的话题。这里没有经过陈大岳老师允许，冒昧的引用一段： 要活的健康, 活的有激情, 活的有vision. 何谓vision? 能够预见社会发展趋势, 是有vision的人, 能够以自己主张改变社会进程的人更有vision. 希望我们都能成为有vision的人吧。]]></description> <content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-230" title="shanghai_subway_1" src="http://www.road2stat.com/cn/attachments/2009/12/01.jpg" alt="shanghai_subway_1" width="500" height="375" /></p><p>写完才发现自己原来用了纯粹的倒叙。</p><p>关于记录，请看<a href="http://www.loyhome.cn/857.html" target="_blank">这位学姐的博文</a>。已经写得很好了。</p><p>唯一的遗憾是这次没能和<a href="http://bjt.name" target="_blank">贝吉塔</a>道别。劝君更尽一杯酒，天下谁人不识君（姊妹篇是这句：垂死病中惊坐起，笑问客从何处来）。</p><p><img class="aligncenter size-full wp-image-232" title="shanghai_subway_2" src="http://www.road2stat.com/cn/attachments/2009/12/03.jpg" alt="03" width="500" height="375" /><br /> <span id="more-229"></span><br /> 当然，这位<a href="http://gaotao.name" target="_blank">有为青年</a>想去延安西路331号的想法没有实现，是我的错，没有事先打探好地点，转而去看了军刀和金茂 ..</p><p>吴江路上的吉野家、生煎、炖汤、朗姆酒、冰淇淋 … Taiyun用典“饕餮”形容我们三个学弟让人发指的FB行径，此言不虚。</p><p><img class="aligncenter size-full wp-image-233" title="one_night_in_shanghai" src="http://www.road2stat.com/cn/attachments/2009/12/02.jpg" alt="one_night_in_shanghai" width="500" height="667" /></p><p><img class="aligncenter size-full wp-image-235" title="Vision_Dec_2009" src="http://www.road2stat.com/cn/attachments/2009/12/04.jpg" alt="Vision_Dec_2009" width="500" height="667" /></p><p>One Night in Shanghai。此行意外收获了一本《<a href="http://www.youthvision.cn" target="_blank">VISION</a>》，周五初到沪上，路过华师附近的一个书报亭，我好奇的问了一句有没有《青年视觉》，没想到阿姨很爽快的说有，城市之间的差距啊 .. 当然，接下来就是四十两银子华丽的杯具 .. 由vision一词，我联想到北大数院的<a href="http://www.math.pku.edu.cn/teachers/dayue/" target="_blank">陈大岳教授</a>在<a href="http://www.math.pku.edu.cn/teachers/dayue/Homepage/ToStudents.htm" target="_blank">写给学生的话</a>中，也曾经讲过关于“vision”的话题。这里没有经过陈大岳老师允许，冒昧的引用一段：</p><blockquote><p> 要活的健康, 活的有激情, 活的有vision. 何谓vision? 能够预见社会发展趋势, 是有vision的人, 能够以自己主张改变社会进程的人更有vision.</p></blockquote><p><img class="aligncenter size-full wp-image-234" title="Sight_of_ECNU_in_Winter" src="http://www.road2stat.com/cn/attachments/2009/12/05.jpg" alt="Sight_of_ECNU_in_Winter" width="500" height="375" /><br /> 希望我们都能成为有vision的人吧。</p> ]]></content:encoded> <wfw:commentRss>http://www.road2stat.com/cn/r_language/2009_user_china_shanghai.html/feed</wfw:commentRss> <slash:comments>12</slash:comments> </item> <item><title>第二届R语言中文会议 @ RUC 第二天趣事及补记</title><link>http://www.road2stat.com/cn/r_language/2009_user_china_beijing_2nd_day_and_memories.html</link> <comments>http://www.road2stat.com/cn/r_language/2009_user_china_beijing_2nd_day_and_memories.html#comments</comments> <pubDate>Tue, 08 Dec 2009 22:34:30 +0000</pubDate> <dc:creator>Xiao Nan</dc:creator> <category><![CDATA[R]]></category> <category><![CDATA[2009]]></category> <category><![CDATA[R语言]]></category> <category><![CDATA[useR]]></category> <category><![CDATA[中国人民大学]]></category> <category><![CDATA[会议]]></category> <category><![CDATA[记忆]]></category> <category><![CDATA[趣事]]></category><guid isPermaLink="false">http://www.road2stat.com/cn/?p=211</guid> <description><![CDATA[美好的时光总是短暂的。这两天总是无意中回想起两天前会议的情景，又看到了太云学长写了通宵的博文，我总觉得要再说点什么。太云学长全面的总结了自己对所有演讲和演讲者的感受，我就从另外的角度简单的补充一点吧。 先说说相当nice的Yanlinlin哥哥，我想说的是，Thank you so much .. 其实Yanlinlin哥哥一眼就看出了我所说问题的核心，并且给了我很好的建议，还与我分享了一些工作中的心得 ..（保持常年开机啊 ，俺还要常常关注你架在自己机器上的blog) 。在上午报告的空闲中，认识了来自BNU的王化儒学长，暑假那次很不成熟的“审稿”时就曾经拜读过学长在第一届会议时的作品，这次见到“真人版”，学长带给我的感觉是一个朴实而有内涵的大男孩 .. 和我想像中的差不多.. 第二天中午用毕午餐后（感谢RUC的会议组织者们，两天的午餐都很丰盛 .. 你们如此的体贴周到 ..再次感动），在bjt的带领下，我和Yanlinlin哥哥、从上海赶来的George Zhang还有牟先生一起小逛了下人大校园，我觉得人大校园的每一个角落似乎都有着bjt的故事和回忆，赞一下名校的校园文化 .. 一个小插曲，George Zhang向我们传授了高端的摄影理论，那就是 —— 都甭看镜头啊！ 于是，预计中几张杰作诞生了 .. 不知范兄是否搜集到了，这里悄悄给出Zhang的摄影博客 低调路过下 .. 我觉得黑白影像的部分尤其好，很有feel .. 第二天中午真的很充实，我还听陈丽云学姐分享了一些写博的经验和学习上的感受，受益匪浅。陈丽云学姐上午的报告，So stylish，用惊艳全场来形容，真的一点都不夸张 .. 陈丽云学姐报告中的精彩瞬间 太云的bi-square graph和bi-circle graph 很有灵感的翻译 .. 有意思的是，我还有另外一点意外收获，是关于钟其顶老师在第一天演讲中留下的神秘问题：“为什么92年的葡萄酒特别好？”我得到的答案是，92年葡萄成熟期的阳光充足，降雨量少，所以葡萄很理想 ..“有心之人”就酿造了很多“92年的葡萄酒”。钟老师他们的工作，正是用量化的手段去鉴别这样的“92年酒”。这让我着实感受到了统计方法，以及R应用范围的广泛，这真的是很奇妙的一件事情。同时，这也恰恰暗合了本次会议的主题，useR &#8230; <a href="http://www.road2stat.com/cn/r_language/2009_user_china_beijing_2nd_day_and_memories.html">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>美好的时光总是短暂的。这两天总是无意中回想起两天前会议的情景，又看到了太云学长<a title="第二届R会议随想" href="http://taiyun.cos.name/2009/12/thoughts-about-2nd-r-conference/" target="_blank">写了通宵的博文</a>，我总觉得要再说点什么。太云学长全面的总结了自己对所有演讲和演讲者的感受，我就从另外的角度简单的补充一点吧。</p><p>先说说相当nice的<a title="Dreaming Life" href="http://yanlinlin82.vicp.net/blog/" target="_blank">Yanlinlin哥哥</a>，我想说的是，Thank you so much .. 其实Yanlinlin哥哥一眼就看出了我所说问题的核心，并且给了我很好的建议，还与我分享了一些工作中的心得 ..（保持常年开机啊 <img src='http://www.road2stat.com/cn/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> ，俺还要常常关注你架在自己机器上的blog) 。在上午报告的空闲中，认识了来自BNU的<a href="http://www.sciencetimes.com.cn/blog/ecomodel.htm" target="_blank">王化儒学长</a>，暑假那次很不成熟的“审稿”时就曾经拜读过学长在第一届会议时的作品，这次见到“真人版”，学长带给我的感觉是一个朴实而有内涵的大男孩 .. 和我想像中的差不多..<br /> 第二天中午用毕午餐后（感谢RUC的会议组织者们，两天的午餐都很丰盛 .. 你们如此的体贴周到 ..再次感动），在<a title="贝吉塔行星" href="http://bjt.name" target="_blank">bjt</a>的带领下，我和<a title="Dreaming Life" href="http://yanlinlin82.vicp.net/blog/" target="_blank">Yanlinlin</a>哥哥、从上海赶来的<a title="Simple Mining" href="http://www.simplemining.com/wp/" target="_blank">George Zhang</a>还有牟先生一起小逛了下人大校园，我觉得人大校园的每一个角落似乎都有着bjt的故事和回忆，赞一下名校的校园文化 .. 一个小插曲，George Zhang向我们传授了高端的摄影理论，那就是 —— 都甭看镜头啊！ 于是，预计中几张杰作诞生了 .. 不知范兄是否搜集到了，这里悄悄给出Zhang的<a title="黑白暗房" href="http://birdzhangxiang.spaces.live.com/" target="_blank">摄影博客</a> 低调路过下 .. 我觉得黑白影像的部分尤其好，很有feel ..</p><p><span id="more-211"></span><br /> 第二天中午真的很充实，我还听<a title="落园" href="http://www.loyhome.cn/" target="_blank">陈丽云学姐</a>分享了一些写博的经验和学习上的感受，受益匪浅。陈丽云学姐上午的报告，So stylish，用惊艳全场来形容，真的一点都不夸张 ..</p><p style="text-align: center;"><img class="aligncenter size-full wp-image-212" title="IMG_3835_2" src="http://www.road2stat.com/cn/attachments/2009/12/IMG_3835_2.jpg" alt="IMG_3835_2" width="588" height="442" /></p><p style="text-align: center;">陈丽云学姐报告中的精彩瞬间</p><p style="text-align: center;"><p style="text-align: center;"><img class="aligncenter size-full wp-image-213" title="IMG_3831_2" src="http://www.road2stat.com/cn/attachments/2009/12/IMG_3831_2.jpg" alt="IMG_3831_2" width="547" height="422" /><br /> 太云的bi-square graph和bi-circle graph 很有灵感的翻译 ..</p><p style="text-align: center;"><p style="text-align: left;">有意思的是，我还有另外一点意外收获，是关于钟其顶老师在第一天演讲中留下的神秘问题：“为什么92年的葡萄酒特别好？”我得到的答案是，92年葡萄成熟期的阳光充足，降雨量少，所以葡萄很理想 ..“有心之人”就酿造了很多“92年的葡萄酒”。钟老师他们的工作，正是用量化的手段去鉴别这样的“92年酒”。这让我着实感受到了统计方法，以及R应用范围的广泛，这真的是很奇妙的一件事情。同时，这也恰恰暗合了本次会议的主题，useR eveRywheRe，R，无处不在。</p><p style="text-align: center;"><p style="text-align: center;"><p style="text-align: center;"><p style="text-align: center;"><p style="text-align: center;"><p style="text-align: left;"><p style="text-align: center;"><p>周日晚踏上返程的列车，一种强烈的不舍之情即刻涌上心头，两天的时间虽然极其短暂，我却收获了相比从前十天、一个月、甚至一年还要多的东西。和大家在一起，自由包容的气氛，真的很美好 .. 同样期待本周上海会场的会议。最后，不妨借用谢大的话作结：</p><blockquote><p>R在中国的繁荣昌盛不会太远了，但同志们需要大大努力。</p></blockquote><p style="text-align: right;"><p style="text-align: right;"><strong>肖楠     己丑年冬日谨识于长沙梅岭村</strong></p> ]]></content:encoded> <wfw:commentRss>http://www.road2stat.com/cn/r_language/2009_user_china_beijing_2nd_day_and_memories.html/feed</wfw:commentRss> <slash:comments>11</slash:comments> </item> <item><title>第二届中国R语言会议 Dec 05-06, 2009 @ RUC</title><link>http://www.road2stat.com/cn/r_language/2009_user_china_beijing.html</link> <comments>http://www.road2stat.com/cn/r_language/2009_user_china_beijing.html#comments</comments> <pubDate>Sat, 05 Dec 2009 14:55:27 +0000</pubDate> <dc:creator>Xiao Nan</dc:creator> <category><![CDATA[R]]></category> <category><![CDATA[2009]]></category> <category><![CDATA[R语言]]></category> <category><![CDATA[useR]]></category> <category><![CDATA[中国人民大学]]></category> <category><![CDATA[会议]]></category><guid isPermaLink="false">http://www.road2stat.com/cn/?p=200</guid> <description><![CDATA[数学分析结课了。随着这门课程最后一次考试的结束，有为青年、李程和俺跟着太云兄在这个周末来到了冬天的北京。周五乍到RUC这所王小波曾经就读、生活过的学校，首先见到的是传说中（太云兄常常提起，所以在见到真人之前就已经印象深刻）学习超好、又超级低调的邱兄，还有整个会议筹备组的工作人员：很nice很gentle的范兄、很有范儿的陈堰平主席、关菁菁学姐、蒋兄 …… 你们的热情款待让我们无比感动 .. So nice you are .. 不同的环境果然造就了不同的人，人大的学长学姐们，都是如此优秀 .. 自叹不如啊 .. 当然，俺在这里一定要感谢远在美国的谢益辉博士和统计界的重量级前辈吴喜之教授（插播一句，俺相当喜欢喜之老师的ppt风格，所以现在总想把字做的很大 ..），没有你们之前的杰出工作和铺垫，我们也不可能有今天这样一个宝贵的机会，来参加这样一次难得的聚会。 今天开会时，俺见到了崇拜已久的CloudyChen学姐和人超帅超慈祥（太云语）的bjt大哥。俺还趁人不备要到了胡江堂大哥和CloudyChen学姐的亲笔签名和赠言 .. 分别签在了《我是一只IT小小鸟》和太云兄所赠《西方文化中的数学》的扉页上，俺仍然沉浸在幸福之中啊 .. 胡江堂大哥平易近人，CloudyChen学姐亦名不虚传，一眼便知学术功底深厚，更写得一手隽秀好字 .. 惭愧啊 .. 在晚宴之中，和bjt大哥，从SH赶来的George Zhang哥哥还有太云兄一起聊了下，觉得他们技术真的很强，人品更是超好 .. 我要从他们身上学习的东西真的还有很多很多 .. 幸福和感动，可以算得上这两天的Keywords。 在今天的演讲中，刘永生老师的《地质环境调查检测研究中的R应用》给我留下了最深的印象，刘老师在工作中积攒了那么多的R实例，还结合了Google Earth做研究工作，真的是“很好很强大” .. bjt的《R在大规模数据整理及自动化报告方面的应用》对R和数据库结合以及Sweave这两个俺很感兴趣的方面进行了深入浅出的讲解，也是相当nice的 .. 关菁菁学姐的RExcel和集成运算、钟其顶老师的R与食品标准研制（俺听了以后没想喝葡萄酒，俺十分想吃鲜葡萄！）、奚兄（俺十分期待你的南京盐水鸭）的灰色理论、宫雨老师的Visual C++中嵌入R代码、还有两位学姐的《R心理学笔记》，都是相当优秀的报告（这两次终于和餐饮没什么关系）。今天从大家的报告中，俺真的收获了不少好东西。 顺便说说俺今天讲的东西吧，其实说到底，不过是一点关于R与安全之间很浅很初级的探索，得到大家的关心和鼓励，俺受宠若惊 .. 不过，其实俺在今天的报告过程中出了一个bug，从引入到正题有一个部分忘记了衔接，事后想起来显得相当突兀 .. &#8230; <a href="http://www.road2stat.com/cn/r_language/2009_user_china_beijing.html">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>数学分析结课了。随着这门课程最后一次考试的结束，有为青年、李程和俺跟着<a href="http://taiyun.cos.name" target="_blank">太云兄</a>在这个周末来到了冬天的北京。周五乍到<a href="http://www.ruc.edu.cn" target="_blank">RUC</a>这所王小波曾经就读、生活过的学校，首先见到的是传说中（太云兄常常提起，所以在见到真人之前就已经印象深刻）学习超好、又超级低调的邱兄，还有整个会议筹备组的工作人员：很nice很gentle的范兄、很有范儿的陈堰平主席、关菁菁学姐、蒋兄 …… 你们的热情款待让我们无比感动 .. So nice you are .. 不同的环境果然造就了不同的人，人大的学长学姐们，都是如此优秀 .. 自叹不如啊 .. 当然，俺在这里一定要感谢远在美国的<a href="http://yihui.name" target="_blank">谢益辉</a>博士和统计界的重量级前辈吴喜之教授（插播一句，俺相当喜欢喜之老师的ppt风格，所以现在总想把字做的很大 ..），没有你们之前的杰出工作和铺垫，我们也不可能有今天这样一个宝贵的机会，来参加这样一次难得的聚会。</p><p style="text-align: center;"><img class="aligncenter size-full wp-image-201" title="RUC_12_05_09" src="http://www.road2stat.com/cn/attachments/2009/12/IMG_3788_2.jpg" alt="RUC_12_05_09" width="470" height="354" /></p><p><span id="more-200"></span></p><p>今天开会时，俺见到了崇拜已久的<a href="http://www.loyhome.cn" target="_blank">CloudyChen学姐</a>和人超帅超慈祥（太云语）的<a href="http://bjt.name">bjt大哥</a>。俺还趁人不备要到了<a href="http://li-and-jiang.com/">胡江堂</a>大哥和CloudyChen学姐的亲笔签名和赠言 .. 分别签在了《我是一只IT小小鸟》和太云兄所赠《西方文化中的数学》的扉页上，俺仍然沉浸在幸福之中啊 .. 胡江堂大哥平易近人，CloudyChen学姐亦名不虚传，一眼便知学术功底深厚，更写得一手隽秀好字 .. 惭愧啊 .. 在晚宴之中，和bjt大哥，从SH赶来的<a href="http://www.simplemining.com" target="_blank">George Zhang哥哥</a>还有太云兄一起聊了下，觉得他们技术真的很强，人品更是超好 .. 我要从他们身上学习的东西真的还有很多很多 .. 幸福和感动，可以算得上这两天的Keywords。</p><p style="text-align: center;"><img class="aligncenter size-full wp-image-202" title="2nd_useR_China_yihui" src="http://www.road2stat.com/cn/attachments/2009/12/IMG_3818_2.jpg" alt="2nd_useR_China_yihui" width="470" height="354" /></p><p style="text-align: center;"><img class="aligncenter size-full wp-image-203" title="2nd_useR_China_gt" src="http://www.road2stat.com/cn/attachments/2009/12/IMG_3820_2.jpg" alt="2nd_useR_China_gt" width="470" height="354" /></p><p>在今天的演讲中，刘永生老师的《地质环境调查检测研究中的R应用》给我留下了最深的印象，刘老师在工作中积攒了那么多的R实例，还结合了Google Earth做研究工作，真的是“很好很强大” .. bjt的《R在大规模数据整理及自动化报告方面的应用》对R和数据库结合以及Sweave这两个俺很感兴趣的方面进行了深入浅出的讲解，也是相当nice的 .. 关菁菁学姐的RExcel和集成运算、钟其顶老师的R与食品标准研制（俺听了以后没想喝葡萄酒，俺十分想吃鲜葡萄！）、奚兄（俺十分期待你的南京盐水鸭）的灰色理论、宫雨老师的Visual C++中嵌入R代码、还有两位学姐的《R心理学笔记》，都是相当优秀的报告（这两次终于和餐饮没什么关系）。今天从大家的报告中，俺真的收获了不少好东西。</p><p>顺便说说俺今天讲的东西吧，其实说到底，不过是一点关于R与安全之间很浅很初级的探索，得到大家的关心和鼓励，俺受宠若惊 .. 不过，其实俺在今天的报告过程中出了一个bug，从引入到正题有一个部分忘记了衔接，事后想起来显得相当突兀 .. 太云兄回来以后严厉的批评了俺，俺痛定思痛，在心里默默撰写了10000字左右的检查，还好下周去SH时还有一次机会 .. 感谢也欢迎大家指出我的错误和问题，对于我认为有道理的，我会毫不犹豫的加以改正。</p><p>俺十分期待明天两朵“乌云”（《矩阵可视化及corrplot包的介绍》、《从经济学到R语言：在经济和计量中使用R》）的报告和最后一场关于Web-R平台的报告会更加精彩。加油！</p><blockquote><p>注：“以太(aether)”和物体比热这两个难题被称为20世纪初物理学晴朗天空中的“两朵乌云”。出乎人们意料的是，这两朵乌云给物理学界带来了革命风暴，使物理学家发现了“新大陆”—— 相对论和量子力学，将人类对物质世界的认识向前推进了一大步。(Thanks for Taiyun's tip)</p></blockquote> ]]></content:encoded> <wfw:commentRss>http://www.road2stat.com/cn/r_language/2009_user_china_beijing.html/feed</wfw:commentRss> <slash:comments>26</slash:comments> </item> </channel> </rss>
