求教大家:qmethod = c("escape", "double")是什么意思? write.csv(x, file = "", append = FALSE, quote = TRUE, sep = " ", eol = "\n", na = "NA", dec = ".", row.names = TRUE, col.names = TRUE, qmethod = c("escape", "double"), fileEncoding = "")
qmethod其实就是quote method的意思
举例如下:
> e='escape quote method(缺省) 将字符型数据中的引号"替换为反斜杠+引号';e
[1] "escape quote method(缺省) 将字符型数据中的引号\"替换为反斜杠+引号"
> d='double quote method 将字符型数据中的引号"替换为两个引号';d
[1] "double quote method 将字符型数据中的引号\"替换为两个引号"
> write.table(e,"escape-qmethod.txt",row.names=F)
> write.table(d,"double-qmethod.txt",qmethod="d",row.names=F)
打开"escape-qmethod.txt"和"double-qmethod.txt"看到:
escape-qmethod.txt:
"x"
"escape quote method(缺省) 将字符型数据中的引号\"替换为反斜杠+引号"
double-qmethod.txt:
"x"
"double quote method 将字符型数据中的引号""替换为两个引号"
注意:如果用单引号括起字符,就不需要给双引号加反斜杠转义符。