[Rd] [patch] Documentation for list.files when no matches found

Tomas Kalibera tom@@@k@liber@ @ending from gm@il@com
Mon Jan 7 09:30:30 CET 2019


Thanks for the report, fixed in documentation in R-devel.

Best
Tomas

On 1/7/19 3:03 AM, Jonathan Carroll wrote:
> Apologies in advance if this is already known but a search of the
> r-devel archive did not immediately turn up any mentions.
>
> list.files() (and thus dir()) returns character(0) when no files are
> found in the requested path. This is useful and expected behaviour as
> length(dir()) can be tested for success. The Value documentation,
> however, indicates otherwise
>
>> A character vector containing the names of the files in the specified directories, or "" if there were no files.
> which would be less useful and does not match current behaviour.
>
> This appears to have been the case for the majority the lifetime of
> the software so I'm not sure it's terribly important, but for the sake
> of consistency, I propose the following simple patch.
>
> Kind regards,
>
> - Jonathan.
>
> --- a/src/library/base/man/list.files.Rd
> +++ b/src/library/base/man/list.files.Rd
> @@ -45,7 +45,7 @@ list.dirs(path = ".", full.names = TRUE, recursive = TRUE)
>   }
>   \value{
>     A character vector containing the names of the files in the
> -  specified directories, or \code{""} if there were no files.  If a
> +  specified directories, or \code{character(0)} if there were no files.  If a
>     path does not exist or is not a directory or is unreadable it
>     is skipped, with a warning.
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list