Learn R Programming

roperators (version 1.3.14)

file_checks: File Extension Checks

Description

Check whether file extension is as specified

Usage

is_txt_file(x)

is_csv_file(x)

is_excel_file(x)

is_r_file(x)

is_rdata_file(x)

is_rda_file(x)

is_rds_file(x)

is_spss_file(x)

check_ext_against(x, ext = "txt")

Value

a logical value

Arguments

x

file(s) to be tested

ext

extension to test against

Examples

Run this code
# create your own file extension checks
is_word_file <- function(x){
  check_ext_against(x, ext = c("doc", "docx"))
}
is_word_file(c("blah.doc", "blah.docx", "blah.txt"))

Run the code above in your browser using DataLab