可能是史上最强更新:R 2.13.0

R 2.13.0今日出炉,一大批更新中有以下条目吸引了我的眼球:

  • image() has gained a logical useRaster argument allowing it to use a bitmap raster for plotting a regular grid instead of polygons. This can be more efficient, but may not be supported by all devices. The default is FALSE. 不知道tikzDevice能否正确处理,如果可以的话,也许可以放心使用image()了,之前由于tikz生成的image()的图形既大(因为是很多矩形)又有难看的白色网格,所以让我一直很纠结。

  • file.copy() now (by default) copies read/write/execute permissions on files, moderated by the current setting of Sys.umask(). 这个问题貌似是我报告过的,因为roxygen拷贝configure文件的时候会把744属性丢失。

  • New hook “before.new.plot” allows functions to be run just before advancing the frame in plot.new, which is potentially useful for custom figure layout implementations. 这让我们可以在.Rprofile文件中设定默认的par(),免得每幅图都要par()来par()去的。

  • Package tools has a new function compactPDF() to try to reduce the size of PDF files via qpdf or gs. 这qpdf貌似也是我推荐的,主要是因为Sweave默认用PDF图形,而这些PDF图形都是没有经过压缩的,所以导致包的体积不必要地大。

  • file.rename() now allows vector arguments (of the same length). 省去了循环。

  • Package compiler is now provided as a standard package. See ?compiler::compile for information on how to use the compiler. This package implements a byte code compiler for R: by default the compiler is not used in this release. See the ‘R Installation and Administration Manual’ for how to compile the base and recommended packages. 也许有人在Google Reader中看到了我的分享,这是Luke Tierney十几年的工作,终于浮出了水面,此举也许能让R的运算速度加快几倍。如果自己通过make install的方式安装,可以先make bytecode,回头测试一下速度。

  • Sweave() has options to produce PNG and JPEG figures, and to use a custom function to open a graphics device (see ?RweaveLatex). (Based in part on the contribution of PR#14418.) 这是我们抱怨了无数遍的一点:Sweave不能使用除了PDF和Postscript之外的图形。在2.14.0中这个问题将进一步得到解决,到时候可以任意自定义图形设备。

  • The default for Sweave() is to produce only PDF figures (rather than both EPS and PDF). 我早说了,这年头有谁还会用老旧的EPS图形啊?2.14.0的时候,一段Sweave代码只会被执行一遍,这也是我期待很久的特征。

  • If there is a field BuildVignettes in the package DESCRIPTION file with a false value, re-building the vignettes is skipped. 此举可节省R包安装时间,尤其是有大的vignette或者其中有CRAN的环境无法编译的代码。

  • File R.css is now installed on a per-package basis (in the package’s html directory) rather than in each library tree, and this is used for all the HTML pages in the package. This helps when installing packages with static HTML pages for use on a webserver. It will also allow future versions of R to use different stylesheets for the packages they install. 同样是抱怨过的问题,R默认的css太丑了,现在包的开发者终于可以自定义R.css了。

  • The gamma argument to hsv(), rainbow(), and rgb2hsv() is deprecated and no longer has any effect. 对我写书有一点小影响,不过我早已经更新这些函数在书中的说明。

总的说来,还是compiler包看起来是最大的更新。

外一篇:一年一度的John Chambers奖

今年的Chambers奖只收到很少几件作品,最终Ian Fellows的Deducer胜出(我又剧透了),尽管我总觉得这玩意儿做得不够优雅。

又及:当年Chambers大人捐赠的奖金只有1万刀,某大佬曾抱怨说,这钱早就花光了!不知道ASA是怎样维持的。

谢益辉 /
Published under (CC) BY-NC-SA in categories R language  tagged with byte code  compiler  R语言  Sweave  vignette  更新