2017-06-04 25 views
1

我想挑列名,將允許空格和特殊字符'在其中。具體而言,我想在下面cbind()使用Cohen's d作爲列名。但現在,我必須Cohensd否則我得到一個錯誤。如何挑選與R中的空間和在``cbind的名字?

我如何使用下cbind()Cohen's d

cbind(Cohensd = c(1, 2), Mean.diff = c(3, 4)) 
+0

除非這是爲了展示目的,這是一個更好的主意,只是使用語法名稱。 – alistaire

回答

1

處理cbind就像一個list。請嘗試以下操作:

cbind("Cohen's d" = c(1, 2), Mean.diff = c(3, 4)) 
2

我們可以使用反引號

cbind(`Cohen's d` = c(1, 2), Mean.diff = c(3, 4)) 
#  Cohen's d Mean.diff 
#[1,]   1   3 
#[2,]   2   4