Returns the separator that consistently separates the lines in the same number of fields, or fails.

csv_sep(x)

Arguments

x

character. File name.

Value

Character representation of the field separator.

Details

Tested separators are: ",", " ", "\t", "|", ";", ":"

Examples

tf <- tempfile() td <- data.frame(T = LETTERS[1:10], N = 1:10) write.csv(td, tf, row.names = FALSE) csv_sep(tf) # ","
#> [1] ","
write.csv2(td, tf, row.names = FALSE) csv_sep(tf) # ";"
#> [1] ";"