Triad sou.

2011-07-01から1ヶ月間の記事一覧

Reference class の initialize メソッドについて

R

initialize メソッドの挙動 を調べていたら、R devel の ML (Ref Classes: bug with using '.self' within initialize methods?) と TractoR というパッケージのコードを見つけ、これを参考に uninitializedField に初期値を与えてみるコードを書きました。 …

About the RcmdrPlugin.KMggplot2

I aim to make a brief version of a ggplot2 GUI-frontend "with Japanese translation (I am Japanese)." I think that the Deducer and the yeroon.net/ggplot2 is pretty good software. Currently, I'm trying to find bugs and to restructure impleme…

RcmdrPlugin.KMggplot2 について

日本語化済みの ggplot2 用の GUI フロントエンドはたぶん無いと思うので、簡易版ですがパッケージを作ってみました。 Deducer や yeroon.net/ggplot2 の様に、もっとしっかりとした良いソフトもありますので、そちらもお試しください。 しばらくはバグ探し…

RcmdrPlugin.KMggplot2_0.0-3 is on CRAN now

RcmdrPlugin.KMggplot2 (CRAN) I posted an Rcmdr plug-in for a "ggplot2" GUI front-end on CRAN. This version supports Kaplan-Meier plot and other plots as follow: Kaplan-Meier plot Show no. at risk on inside Show no. at risk table on outside…

An alternative of the base:setdiff(x, y) for list objects

Using the base::unique(x), the base::setdiff(x, y) has the same problem as follow: > unique(list(a=1,b=2,c=3,a=1)) [[1]] [1] 1 [[2]] [1] 2 [[3]] [1] 3 So, I wrote an alternative of the base::setdiff(x, y) function, too. lsetdiff <- functio…

An alternative of the base:unique(x) for list objects

The base::unique(x) function returns a vector, data frame or array that were removed duplicate elements/rows. When the x is a list object, the base::unique(x) returns an unnamed list object as follow: > unique(list(a=1,b=2,c=3,a=1)) [[1]] …

リストを ... (dot-dot-dot) 引数に変換して関数を実行する方法

R

tkgrid にリストを投げるとエラーを頂戴するので、足掻いてみました。 この場合は単に do.call で OK、勉強不足でした。 require(tcltk) tt <- tktoplevel() b1 <- tkbutton(tt, text = "OK 1", command = function() tkdestroy(tt)) b2 <- tkbutton(tt, tex…

R の model.frame オブジェクトについて

R

model.frame オブジェクト model.frame オブジェクトは、R でデータとモデル式を統一的に扱うためのオブジェクトです。 実体は data.frame クラスのデータに、モデル式を含むいろいろな attributes が付加されたものです。 d <- e <- rep(1, 10) c <- 1:10 b …

コメント化・コメント解除のショートカット

SAS

小ネタ Windows 版 SAS の Enhanced Editor では、文字列を選択し "Ctrl + ?" を押すと 選択範囲をコメント化できる。 "Ctrl + Shift + ?" を押すと 選択範囲のコメントを解除できる。

reorder 関数を使って横軸の順序の並べ替えを行う方法

ggplot2 で geom_bar(stat = "identity") を利用して棒グラフを作成するときに、横軸の順序を変える方法をまとめてみます。 特に要約データなどを持っていて、ヒストグラムをプロットしたい時などに利用できるかと思います。 方法としては、データフレームに…