writecn.delim: Write a data.frame that has Chinese characters

View source: R/writecn.delim.r

writecn.delimR Documentation

Write a data.frame that has Chinese characters

Description

Handle a data.frame with Chinese characters and write it into a UTF-8 text file with header, no row.names, tab delimited fields.

Usage

writecn.delim(db, file = "",row.names = FALSE, quote = FALSE, sep = "\t", ...)

Arguments

db

a data.frame

file

file name (character string)

row.names

either a logical value indicating whether the row names of 'x' are to be written along with 'x', or a character vector of row names to be written

quote

a logical value or a numeric vector. If 'TRUE', any character or factor columns will be surrounded by double quotes. If a numeric vector, its elements are taken as the indices of the columns to quote. In both cases, row and column names are quoted if they are written. If 'FALSE', nothing is quoted.

sep

the field separator string. Values within each row of 'x' are separated by this string.

...

additional arguments to pass to write.table

Details

Writing a data.frame into text files can be quite cumbersome if the system locale is not Chinese. This function set up the locale to Chinese, write the data.frame using write.table with fileEncoding = "UTF-8", then restore the original locale.

Value

An ascii text file, tab delimited.

See Also

write.table, Sys.setlocale


pgirmess documentation built on May 29, 2024, 4:26 a.m.