1

入力ファイルが 1 つあります。

猫ファイル

      IstCol (ABC) IInd COl (DEF) 
      34           45 
      32           45

      > input<-read.table("file",sep="\t",header=TRUE)
      > input
      IstCol..ABC..IInd.COl..DEF.
      1            34           45 
      2             32           45

しかし、括弧は認識しません。それを認識するためにどのような変更を加える必要がありますか?

4

1 に答える 1

1

read.tableデフォルトでは、列名が有効な変数名であるかどうかがチェックされ、それらが一意である場合は、次のように設定してオフにすることができますcheck.names = F

input <- read.table("file", sep="\t", header=T, check.names=F)

$演算子を使用して変数を呼び出す場合、列名は重要です。マニュアルからの説明:

check.names: logical.  If 'TRUE' then the names of the variables in the
          data frame are checked to ensure that they are syntactically
          valid variable names.  If necessary they are adjusted (by
          'make.names') so that they are, and also to ensure that there
          are no duplicates.
于 2018-06-01T10:31:43.210 に答える