Displaying 2 results from an estimated 2 matches for "xischar".
Did you mean:
ischar
2017 Sep 19
2
what do you think about write.table(... qmethod = "excel")?
On 19/09/2017 4:10 PM, Ista Zahn wrote:
> On Tue, Sep 19, 2017 at 1:04 PM, Paul Johnson <pauljohn32 at gmail.com> wrote:
>> Last week one of our clients reported trouble with a csv file I
>> generated with write.table. He said that columns with quotes for
>> character variables were rejected by their data importer, which was
>> revised to match the way Microsoft
2017 Sep 20
0
what do you think about write.table(... qmethod = "excel")?
...- tempfile(pattern = "testcsv", fileext = ".csv")
##' writeCSV(x1, file = fn)
##' readLines(fn)
##' x2 <- read.table(fn, sep = ",", header = TRUE, stringsAsFactors = FALSE)
##' all.equal(x1,x2)
writeCSV <- function(x, file, row.names = FALSE){
xischar <- colnames(x)[sapply(x, is.character)]
for(jj in xischar){
x[ , jj] <- gsub('"', '""', x[ , jj], fixed = TRUE)
needsquotes <- grep('[\",]', x[ ,jj])
x[needsquotes, jj] <- paste0("\"", x[needsquotes,...