"overwrite" argument default value set to "recursive"


In "file.copy" R function,
what mean "recursive" in "overwrite" argument default value ?

> args(file.copy)
function (from, to, overwrite = recursive, recursive = FALSE,  
    copy.mode = TRUE, copy.date = FALSE)

>Solution :

That means overwrite will use the value of recursive by default. Since recursive is false by default, overwrite will be false if both are left unspecified. If you change recursive to true and leave overwrite unspecified, it will also become true. It’s just telling you where the default value is coming from.

call overwrite recursive
file.copy() FALSE FALSE
file.copy(recursive=TRUE) TRUE TRUE
file.copy(overwrite=TRUE) TRUE FALSE
file.copy(overwrite=FALSE, recursive=TRUE) FALSE TRUE

Leave a ReplyCancel reply