更新时间:2023-01-31 09:36:50
不是错误,更多的是在构造data.frame
时对基础类型系统转换(character
类型和factor
类型)的误解.
Not a bug, more a misunderstanding of the underlying type system conversions (the character
type and the factor
type) when constructing a data.frame
.
您可以先从data <-read.csv("mydata.csv", encoding="UTF-8", stringsAsFactors=FALSE)
开始,这将使您的汉字成为character
类型,因此通过将它们打印出来,您应该会看到期望的文字.
You could start first with data <-read.csv("mydata.csv", encoding="UTF-8", stringsAsFactors=FALSE)
which will make your Chinese characters to be of the character
type and so by printing them out you should see waht you are expecting.
@nograpes:类似x=c('中華民族');x; y <- data.frame(x, stringsAsFactors=FALSE)
,一切正常.
@nograpes: similarly x=c('中華民族');x; y <- data.frame(x, stringsAsFactors=FALSE)
and everything should be ok.