2

次のようなリストがあります。

> ascii
  [1] "\033" "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032"
 [11] "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032"
 [21] "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032"
 [31] "\032" "\032" "0"    "0"    "0"    "0"    "0"    "0"    "0"    "0"   
 [41] "0"    "0"    "0"    "0"    "0"    "0"    "0"    "0"    "0"    "0"   
 [51] "0"    "0"    "0"    "0"    "0"    "0"    "0"    "0"    "0"    "0"   
 [61] "0"    "0"    "0"    "0"    "0"    "0"    "0"    "0"    "0"    "0"   
 [71] "0"    "0"    "0"    "0"    "0"    "0"    "0"    "0"    "0"    "0"   
 [81] "0"    "0"    "0"    "0"    "0"    "0"    "0"    "0"    "0"    "0"   
 [91] "0"    "0"    "0"    "0"    "0"    "0"    "0"    "0"    "0"    "0"   
[101] "0"    "0"    "0"    "0"    "0"    "0"    "0"    "0"    "0"    "0"   
[111] "0"    "0"    "0"    "0"    "0"    "0"    "0"    "0"    "0"    "0"   
[121] "0"    "0"    "0"    "0"    "0"    "0"    "\032" "\032" "\032" "\032"
[131] "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032"
[141] "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032"
[151] "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032"
[161] "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032"
[171] "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032"
[181] "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032"
[191] "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032"
[201] "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032"
[211] "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032"
[221] "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032"
[231] "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032"
[241] "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032" "\032"
[251] "\032" "\032" "\032" "\032" "\032" "\032"

このリストに特定の ascii 文字を書きたいと思います (このリストは ascii と呼ばれます)。たとえば、「\032」と表示されている場所にスペース「 」が必要です。ascii[1:32] <- "\032"...しかし、これは正確に「\032」をそれらの位置に書き込みます...「\045」などのいくつかの文字で動作します.. .

ascii[1:32] <- " " とは言わないでください。リストに他の ASCII 文字を紹介したいのですが、文字よりも数字を書いたほうがいいので...

どうもありがとう!

4

1 に答える 1

1

編集:更新

R は数字のみを使用します。たとえば

myascii<-c(65,66,67)

rawToChar(as.raw(myascii))

ABCを与える

したがって、配列を変更するときに「\ 066」の代わりに66を使用するだけです

于 2013-10-25T17:23:04.530 に答える