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
4

1 回答 1

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
于 2013-10-01T08:41:50.980 回答