Insert comma between characters with R
r
Solution
You're after the aesthetic not the functional with this answer:
cat(paste0('"', paste(char, collapse="\", \""), '"'))
## "115030", "118990", "72910", "121050", "93820", "119310", "110370", "100590", "98220", "118200"
To store:
store <- paste0('"', paste(char, collapse="\", \""), '"')
Problem
Sample data: ``` data <- round(rnorm(10,100000,10000),-1) char <- as.character(data) ``` and I would like comma between the characters: ``` [1] "104350","108800","101320","94140","102260","89340","114220","105830","111270","85300" ``` I have tried `paste()` and also `read.table` & `read.lines` with `sep=","` with no success.