From tom@@@k@liber@ @ending from gm@il@com  Mon Jan  7 09:30:30 2019
From: tom@@@k@liber@ @ending from gm@il@com (Tomas Kalibera)
Date: Mon, 7 Jan 2019 09:30:30 +0100
Subject: [Rd] [patch] Documentation for list.files when no matches found
In-Reply-To: <CAAjDRig3e9kwSBkDDb9UTb3BtbXYqrTrG2L0KKyxTOevvGF3fg@mail.gmail.com>
References: <CAAjDRig3e9kwSBkDDb9UTb3BtbXYqrTrG2L0KKyxTOevvGF3fg@mail.gmail.com>
Message-ID: <85c97a1d-ed77-7b27-419d-2a0a0ab3d128@gmail.com>

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 at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



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