R_old_tips3
# $ fc-list : family
# $ xlsfonts -fn -ipamona-gothic-*-*-*-*-*-*-*-*-*-*-*-*
grDevices::X11.options(
fonts=c("-ipamona-gothic-*-*-*-*-*-*-*-*-*-*-*-*", ## "-kochi-gothic-%s-%s-*-*-%d-*-*-*-*-*-*-*",
"-adobe-symbol-medium-r-*-*-%d-*-*-*-*-*-*-*"))
grDevices::pdf.options(family="Japan1GothicBBB")
grDevices::ps.options(family="Japan1GothicBBB")
- 自作パッケージ
- Rを最新版にした結果、RExcel が起動しなくなった場合
- RExcel
- R の参考書
- 資料
- RとEmacsとGDBでデバッグ
- Rcpp
- Rcpp_DataFrame
- Rの正規表現で URL 抽出.
- Rでシフト演算
- animation
- RHIPE - R and Hadoop Integrated Processing Environment
- Putting Robust Standard Errors into LaTeX Tables An Extension of mtable
- Building and checking R source packages for Windows
- R 2.12 to 2.13 package upgrade
- How to upgrade R on windows 7
- Server版RStudio Ubuntu
- 分割表をもとのデータに
- Rで曜日と月の数を数える:
- CRANberries
- zapsmall
- R_Connection
- R_sqLite_Excel
- if_else
- rawToChar
- Unicode_utf8
- ReferenceClasses
- Rcpp
- 疎行列を作成する
- boxplot
- 適合度の検定における最小期待値
- CS3とEPS
- RCurl
- if の返り値
- lme による分散成分の標準誤差
- .Primitives
- Cairo
_ 自作パッケージ
_ Rを最新版にした結果、RExcel が起動しなくなった場合
R を管理者権限で実行し
- R のメニュー パッケージ を使って Rcmdr をインストール
- R のメニュー パッケージ を使って RExcelInstaller? をインストール
- library(RExcelInstaller?) を実行
- installRExcel() を実行する
- Setup ウイザードの指示に従って next, install をクリックしていく
- 念のため RExcel を管理者権限で実行
以上です
RExcel を含め、古いRにインストールしていたパッケージをすべて新しい環境に移したい場合は
http://sunsite.univie.ac.at/rcom/ トップメニュー Wiki -> 左フレーム How to upgrade R with our packages installed
その他,中澤先生のサイトも参照ください
_ RExcel
_ R の参考書
-
:R でコーパス・テキスト・言語処理を行うための入門書ですが,第3章にRの包括的な入門があります.
-
中級者になるために.
-
解析をばりばり行うために.
-
データをばりばり処理するために.
-
R のプログラミングテクニックを学ぶために.
-
R での解析手法に慣れるために.
-
とにかく R を使ってみたい.
-
統計学と R を同時に学びたい.
_ 資料
準備途上 Windows 用実行ファイル &ref(): File not found: "ism20091124.R" at page "R_old_tips3";
- 第91回行動計量シンポジウム
TextMining2.pdf - 行動計量学会第35回全国大会 関係 (チュートリアルpdf
HowToR.pdf &発表pdf
bsj2007.pdf ) - 統計的言語処理
- ラプラス近似.ここによいメモ
R についての最近のメモ
_ ************
_ RとEmacsとGDBでデバッグ
_ Rcpp
_ Rcpp_DataFrame
_ Rの正規表現で URL 抽出.
とりあえず,手っ取り早くこんなもん.ただし,抽出できない場合もあるので注意.
str <- "これはhttp://cran.r-project.org/で,あれはhttp://www.yahoo.co.jp/です."
tmp <- gregexpr ("https?://.+/(.+/)*?", str)
substring(str, tmp[[1]], tmp[[1]] + attr (tmp[[1]], 'match.length') -1)
_ Rでシフト演算
_ animation
_ RHIPE - R and Hadoop Integrated Processing Environment
_ Putting Robust Standard Errors into LaTeX Tables An Extension of mtable
_ Building and checking R source packages for Windows
_ R 2.12 to 2.13 package upgrade
_ How to upgrade R on windows 7
_ Server版RStudio Ubuntu
_ 分割表をもとのデータに
_ Rで曜日と月の数を数える:
_ CRANberries
_ zapsmall
_ R_Connection
_ R_sqLite_Excel
_ if_else
_ rawToChar
_ Unicode_utf8
_ ReferenceClasses
とりあえずここを参考にサンプルを実行してみる
## a simple editor for matrix objects. Method $edit() changes some
## range of values; method $undo() undoes the last edit.
mEditor <- setRefClass("matrixEditor",
fields = list( data = "matrix",
edits = "list"),
methods = list(
edit = function(i, j, value) {
## the following string documents the edit method
'Replaces the range [i, j] of the
object by value.
'
backup <-
list(i, j, data[i,j])
data[i,j] <<- value
edits <<- c(list(backup),
edits)
invisible(value)
},
undo = function() {
'Undoes the last edit() operation
and update the edits field accordingly.
'
prev <- edits
if(length(prev)) prev <- prev[[1]]
else stop("No more edits to undo")
edit(prev[[1]], prev[[2]], prev[[3]])
## trim the edits list
length(edits) <<- length(edits) - 2
invisible(prev)
}
))
xMat <- matrix(1:12,4,3)
xx <- mEditor$new(data = xMat)
xx$edit(2, 2, 0)
xx$data
xx$undo()
mEditor$help("undo")
stopifnot(all.equal(xx$data, xMat))
## add a method to save the object
mEditor$methods(
save = function(file) {
'Save the current object on the file
in R external object format.
'
base::save(.self, file = file)
}
)
tf <- tempfile()
xx$save(tf) #$
_ Rcpp
_ 疎行列を作成する
_ boxplot
_ 適合度の検定における最小期待値
期待値が5未満のセルが20%あるといけないなどというが,一度,この根拠をしらべてみたことがある.このWikiのどこかにあるはずなのだが,みつからない.で,青木先生のサイトに情報があった.
_ CS3とEPS
Rで作成した日本語入りEPSを, Windows の CS3 で確実に読みこんでもらうには
library(Cairo) CairoFonts( regular="IPA P明朝,IPAPMincho:style=Regular", bold="IPA Pゴシック,IPAPGothic:style=Regular,Bold", italic="IPA P明朝,IPAPMincho:style=Regular,Italic", bolditalic="IPA Pゴシック,IPAPGothic:style=Regular,Bold Italic,BoldItalic") CairoPS(file = "/home/ishida/cairo.ps", bg="white") plot(1:10, 1:10, main ="テスト", cex = 1.2) dev.off() embedFonts(file ="~/cairo.ps", outfile ="~/Cairo2.eps" )
としておく.ここも参照
_ PDF
根本的解決に至っていないが R 上で日本語を含む PDF を作成できない. とりあえず
library(Cairo) # CairoFonts(regular="VL ゴシック,VL Gothic:style=regular") CairoFonts(regular="IPA P明朝,IPAPMincho:style=Regular") CairoPS(file = "Fig", bg="white")
hogehoge
dev.off()
として ps を作成し,変換しておく
_ RCurl
twitteR のインストールに必要だが,'curl' と 'libcurl3 に加えて,以下のコマンドの出力が示すように libcurl4-openssl-dev が必要
$ apt-cache search libcurl3-dev libcurl4-openssl-dev - Development files and documentation for libcurl (OpenSSL) $ apt-get install libcurl4-openssl-dev
ここ を参照
_ if の返り値
x <- 0
y <- if(x + 1){
x + 100
}else{
x - 100
}
y
[1] 100
#
y <- if(x + 1) cat("TRUE\n")# else cat("FALSE\n")
if(y <- x + 1) cat("TRUE\n") else cat("FALSE\n")
_ lme による分散成分の標準誤差
- Rjpwikiに lme の出力から分散成分の標準誤差を取り出したいという議論があるが,Batesがしばしば指摘しているようA,B) に,確率区間を使うべき.確率区間の計算は interval.lme() だから getS3method("interval", "lme") を実行して,一度アルゴリズムを確認すれば良いかなと思うのだけど.
_ .Primitives
2校演算子の定義するためにはクオートするが,呼び出しは以下のように,ダブルコーテーションも使えるのか
> str(`*`)
function (e1, e2)
> get("*")
function (e1, e2) .Primitive("*")
> `*`(3,3)
[1] 9
> get("*")
function (e1, e2) .Primitive("*")
> "*"(3,3)
[1] 9
> `like this` <- 2
> "like that" <- 3
> print(`like this`)
[1] 2
> print("like that")
[1] "like that"
_ Cairo
Link: RMeCab(1048d)
RExcel_2019(2289d)
R_old_tips4(2344d)
R_old_tips2(2344d)
RCaBoCha(4825d)
Rcpp_DataFrame(5206d)
Rcpp(5206d)
R_Shift(5280d)
R_Slide_Video(5295d)
animation(5310d)
Server版RStudio Ubuntu(5311d)
ConvertTableToRawData(5400d)
RExcel(5413d)
Unicode_utf8(5418d)
ReferenceClasses(5422d)
Rで曜日と月の数を数える:(5434d)
zapsmall(5455d)
R_Connection(5457d)
R_sqLite_Excel(5457d)
if_else(5465d)
rawToChar(5503d)
Sparse_Document_Term_Matrix(5584d)
R2MeCab(5599d)
boxplot(5606d)
Cairo(5645d)
統計的言語処理(6153d)
R_fromOldHtml3(6656d)
Last-modified: 2019-07-17 (水) 09:03:48 (2344d)