is.csv.file: is the file a comma separated text file?

Description Usage Arguments Value Note Author(s) Examples

View source: R/is.csv.file.R

Description

Rather than just checking the file extension, this function checks whether the contents of the file contain tabs. The file paths must exist, they must be ASCII test, and must have at least one comma in one of the lines to qualify.

Usage

1

Arguments

path

a character vector: the path(s) to file(s) which must exist

Value

a named logical vector of length(path), where names are the paths, and values are TRUE if the path is an excel file, FALSE otherwise.

Note

We could make this more stringent by requiring that all lines contain the same number of comma's, but need to consider how to skip header lines, and column name lines which can contain NCOL-1 columns (if written using write.table), and what to do with rogue comma's in the middle of column

Author(s)

Mark Cowley, 2012-02-01

Examples

1
2
3
4
5
6
7
## Not run: 
is.csv.file("./tmp.xls")
is.csv.file("./tmp.tsv")
is.csv.file("./tmp.csv")
is.csv.file(c("./tmp.xls", "./tmp.tsv", "./tmp.csv"))

## End(Not run)

drmjc/excelIO documentation built on Aug. 3, 2019, 5:16 p.m.