« [R]エラーメッセージ「In scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : EOF within quoted string」 | トップページ | [Visual Basic]四捨五入を行う »

2014年6月 2日 (月)

[R]エンコードを指定する際の文字を調べる(使用できるエンコードの一覧を表示する)

iconvlist関数を使用する。

> iconvlist()
  [1] "437"                     "850"
  [3] "852"                     "855"
(以下、表示省略)

Windowsでよく使用されるシフトJISは、shift_jis、SJISなどと定義されている。

文字列でベクトルで返すため、検索などが簡単にできる。

> length(iconvlist())
[1] 374
> mode(iconvlist())
[1] "character"
> grep("jis|JIS", iconvlist(), value = TRUE)
[1] "SHIFFT_JIS" "SHIFFT_JIS-MS" "shift-jis" "shift_jis"
[5] "SJIS" "SJIS-MS" "SJIS-OPEN" "SJIS-WIN"

« [R]エラーメッセージ「In scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : EOF within quoted string」 | トップページ | [Visual Basic]四捨五入を行う »

R(文字と文字列)」カテゴリの記事

コメント

コメントを書く

コメントは記事投稿者が公開するまで表示されません。

(ウェブ上には掲載しません)

« [R]エラーメッセージ「In scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : EOF within quoted string」 | トップページ | [Visual Basic]四捨五入を行う »

無料ブログはココログ

■■

■■■