如何在行名中生成括号?

时间:2013-10-01 08:38:18

标签: r

如何在行名中生成括号?

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

1 个答案:

答案 0 :(得分: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