Description Usage Arguments Value Author(s) See Also Examples
View source: R/is.excel.file.R
Rather than just checking the file extension, this function checks
whether the contents of the file are a Microsoft Excel file, using the
GNU file
program, thus this will not work on Windows. file
works by checking the file signature to see what file type it is.
Note that XLS files can have different file signatures depending where
they are saved from/created.
1 2 3 4 5 | is.excel.file(path)
is.xls.file(path)
is.xlsx.file(path)
|
path |
a character vector: the path(s) to file(s) which must exist |
A logical vector
of length(path)
, where
the values are TRUE
if the path is an XLS, XLSX, or both, FALSE
otherwise, for is.xls.file
, is.xlsx.file
, or
is.excel.file
, respectively.
Mark Cowley, 2012-02-01
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## Not run:
# df <- data.frame(A=1:10, B=letters[1:10], C=LETTERS[1:10], D=TRUE, E=FALSE)
require(datasets)
write.table(iris, "tmp.tsv", quote=FALSE, sep="\t")
write.csv(iris, "tmp.csv")
require(dataframes2xls)
write.xls(iris, "tmp.xls")
require(xlsx)
write.xlsx(iris, "tmp.xlsx")
is.excel.file("./tmp.xls")
is.excel.file("./tmp.xlsx")
is.excel.file("./tmp.tsv")
is.excel.file("./tmp.csv")
is.excel.file(c("./tmp.xls", "./tmp.xlsx", "./tmp.tsv", "./tmp.csv"))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.