日録2008年12月 のバックアップ(No.10) - アールメカブ

アールメカブ


日録2008年12月 のバックアップ(No.10)


過去の日録

_ 2008年12月4日 (木) 晴

  • 06:00 起床
    • 07:30 研究室着,
  • 午前
    • 朝いちで,昨日の日本語アンケートデータの分析を続ける.レポート担当のB君のために,多重ロジットモデルの結果の解釈方法を,説明したメモを書く.明日から学会なので,口頭で説明する余裕がない.
    • 10:25-12:00 演習
  • 午後. K 氏,N 氏らと近くのファミレスに.ハンバーグランチ523円なり.
    • Elecomのブックスタンド EDH-004 を買ってみた.Latticeなどの原稿書きを進めるのに,いくつかの本を開きっぱなしに作業しなければならないので,役に立つかもしれないと思ったのだが,結構よさそう.

_ 2008年12月3日 (水) 晴

  • 06:00 起床
    • 07:30 研究室着
  • 午前
    • 今日も一日授業の日だが、合間を縫って、日本語アンケートデータの分析。分析だけではなく、結果をレポートする担当の方のために、解説も書かなければならない。
    • 08:30-10:30 演習
  • 午後
    • データフレームをランダムに二つに分ける処理って、こうする 以外に、もっと簡単な手があった気がするんだが。。。
    • 12:55-16:05 講義
    • 18:00-19:30 演習
    • 面白そうな R パッケージが公開されている.
New Rcpp versions 0.6.0 and 0.6.1
---------------------------------
		
The Rcpp package provides C++ classes that greatly
facilitate  interfacing C
or C++ code in R packages using the .Call() interface
 provided by R.

Rcpp provides matching C++ classes for a large number of 
basic R data  types. 
Hence, a package author can keep his data in normal 
R data structure
without having to worry about translation or transfer
 to C++. 
At the same time, the data structures can be accessed as
 easily  at the C++ level, and used in the normal manner.

The mapping of data types works in both directions.
It is as straightforward to pass data from R to C++, 
as it is it return data from C++ to R.  
The following two sections list supported data types.

Transfer from R to C++:
Standard R datatypes that are understood in C++ are
o named lists containing numeric (i.e. floating point),
  integer,  character, logical (i.e. boolean) or Date and
 Datetime (i.e. POSIXct at
  the microsecond granularity) arguments;
o data frames containing numeric, integer, logical,
 character, Date, Datetime or Factor columns;
o named vectors containing numeric or integer values,
o vectors and matrices of different values
o character strings
 
Transfer from C++ to R:
Standard C++ datatypes can be returned to R 
in a named list,  the most general data type in R.
Permissible components of the returns list are the
following   C++ types:
o double (scalar as well as vectors and vectors of vectors),
o int (scalar as well as vectors and vectors of vectors), 
      string,
o STL vector types and vector<vector> types of int 
      and double
o STL vector of strings
o internal Rcpp types RcppDate, RcppDateVector,
      RcppDatetime,   RcppDatetimeVector, 
      RcppStringVector, RcppVector of int or double,
      RcppMatrix of int or double, RcppFrame
 
Rcpp was initially written by Dominick Samperi as part of 
his contributions to RQuantLib, and later released as a 
standalone package (under both the Rcpp and
 RcppTemplate  names). 
 Its development had ceased in late 2006.
 
As of November 2008, I have made new release with
 substantially expanded documentation, 
simpler yet more comprehensive build structure leading to
easier use of Rcpp from other packages, and 
support for Windows, Linux and Mac OS X 
(with special thanks to Simon for some extended
 cluebat waving).
More information for Rcpp can be found at
o the package homepage at 
http://dirk.eddelbuettel.com/code/rcpp.html
o the R-forge repository at 
https://r-forge.r-project.org/projects/rcpp/
o the CRAN page at
http://cran.r-project.org/web/packages/Rcpp/index.html
Regards,  Dirk
  • すき焼きで獺祭を一杯

_ 2008年12月2日 (火) 晴

  • 06:00 起床
    • 07:30 研究室着
  • 午前
    • 昨日の午後から,花粉症の症状がひどい.例年は,年明けぐらいからなんだけど,,,
    • Lattice にタイタニックのデータがあった,等級ごとの生存割合をみるには,モザイクプロットより分かりやすい気がする.
> barchart(Class ~ Freq | Sex + Age,
             data = as.data.frame(Titanic),
	      groups = Survived, stack = TRUE, layout = c(4, 1),
	      auto.key = list(title = "Survied", colums = 2),
	      scales = list(x = "free") )
  • 午後
    • 14:35-18:30 演習

_ 2008年12月1日 (月) 晴

  • 06:00 起床
    • 07:30 研究室着,
  • 午前
    • Lattice を翻訳していると,目から鱗という機能が山ほどあることに気がつく.
    • Atok for Linux を Emacs 上で使って原稿書いているんだが,時々,Atok がフリーズすることがあって,そんな場合 Emacs ごと落とす羽目になるので,厄介だ.
  • 午後 ひたすらLattice
    • 急に花粉症風の症状が出てきた.何で,突然?
    • latice パッケージの関数は,引数の指定が正しくない場合,妙なエラーや,あるいは妙なグラフを作成している.それはそれで面白いけど.
key.variety <- list(space = "right", 
         text = list(levels(Oats$Variety)), 
         points = list(pch = 1:3, col = "black"))
xyplot(yield ~ nitro | Block, Oats, aspect = "xy", 
         type = "o",  groups = Variety, 
          key = key.variety, lty = 1, pch = 1:3, 
         col.line = "dargrey", col.symbol = "black") 

darkgrey の綴りを間違えて指定すると,グラフは作成されるものの,折れ線の代わりに,「パラメータの設定がおかしいだろう!」というメッセージがずらずらと表示されてしまう. また引数名と間違えると,その引数に設定したオブジェクトがないだろうなどというエラーに遭遇する.

dotplot(variery ~ yield | site,  barley, layout = c(1,6), 
           aspect = c(0.7), grous = year, 
           auto.key = list(space = "right") ) 
以下にエラー bwplot.formula(x = variery ~ yield | site, 
  data = list(yield = c(27,  : 
  オブジェクト "year" は存在しません 

groups の綴りを間違えたんだけど...