2013-10-01 75 views
0

如何在行名中生成括號?如何在行名中生成括號?

data.frame("gender"=c("man","woman"),"number(live in school)"=c(2340,1890)) 

    gender number.live.in.school. 
1 man     2340 
2 woman     1890 

我想要得到的格式輸出的是:

gender number(live in school) 
1 man     2340 
2 woman     1890 

回答

5

使用參數check.names = FALSE

data.frame("gender" = c("man","woman"), "number(live in school)" = c(2340,1890), 
      check.names = FALSE) 

# gender number(live in school) 
# 1 man     2340 
# 2 woman     1890 
相關問題