2011-07-01から1ヶ月間の記事一覧
initialize メソッドの挙動 を調べていたら、R devel の ML (Ref Classes: bug with using '.self' within initialize methods?) と TractoR というパッケージのコードを見つけ、これを参考に uninitializedField に初期値を与えてみるコードを書きました。 …
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…
日本語化済みの ggplot2 用の GUI フロントエンドはたぶん無いと思うので、簡易版ですがパッケージを作ってみました。 Deducer や yeroon.net/ggplot2 の様に、もっとしっかりとした良いソフトもありますので、そちらもお試しください。 しばらくはバグ探し…
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…
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…
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]] …
tkgrid にリストを投げるとエラーを頂戴するので、足掻いてみました。 この場合は単に do.call で OK、勉強不足でした。 require(tcltk) tt <- tktoplevel() b1 <- tkbutton(tt, text = "OK 1", command = function() tkdestroy(tt)) b2 <- tkbutton(tt, tex…
model.frame オブジェクト model.frame オブジェクトは、R でデータとモデル式を統一的に扱うためのオブジェクトです。 実体は data.frame クラスのデータに、モデル式を含むいろいろな attributes が付加されたものです。 d <- e <- rep(1, 10) c <- 1:10 b …
小ネタ Windows 版 SAS の Enhanced Editor では、文字列を選択し "Ctrl + ?" を押すと 選択範囲をコメント化できる。 "Ctrl + Shift + ?" を押すと 選択範囲のコメントを解除できる。
ggplot2 で geom_bar(stat = "identity") を利用して棒グラフを作成するときに、横軸の順序を変える方法をまとめてみます。 特に要約データなどを持っていて、ヒストグラムをプロットしたい時などに利用できるかと思います。 方法としては、データフレームに…