The filename()
function offers an
filename(x,path= NULL,tag= NULL,ext= NULL,date= NULL,time= NULL,subdir= TRUE)
x
: This shows the file name.path
: This is the path of the file. Its default value is NULL
.tags
: These are the tags regarding the file name. Its default value is NULL
.ext
: This is the file extension. Its default value is NULL
.date
: This is the date stamp. Its default value is NULL
.time
: This is the time stamp. Its default value is NULL
.subdir
: This is used to append the date or time subdirectory to the path. Its default value is TRUE
.It constructs and returns the as.filename
object.
library(filenamer)# by default the date stamped subdirectory is appended in filename function.fln1 <- filename("data", tag="qc", ext="txt")print(as.character(fln1))# disabling date stamped subdirectory inclusionfln2 <- filename("data", tag="qc", date=NA, time=NA, subdir=FALSE)print(as.character(fln2))# creating a new filename using an existing filename.fln3 <- filename(fln1)print(as.character(fln3))
filename
object and the date stamped subdirectory is appended by default in the file name.filename
object using the existing filename
and print it as a character sequence on the console.Note: In lines 4, 8, and 12, the as.character() method converts a numeric object into a character data type or string data type.