From @purd|e@@ @end|ng |rom gm@||@com  Sun Jun 23 02:38:07 2019
From: @purd|e@@ @end|ng |rom gm@||@com (Abby Spurdle)
Date: Sun, 23 Jun 2019 12:38:07 +1200
Subject: [Rd] head with non integer n returns confusing output
In-Reply-To: <CAEKh8ujebf5oKxWbSHLgyU1cNtbh7=U0dp6k_nne=-gUenUdgQ@mail.gmail.com>
References: <CAEKh8ujebf5oKxWbSHLgyU1cNtbh7=U0dp6k_nne=-gUenUdgQ@mail.gmail.com>
Message-ID: <CAB8pepwaapVkEVOhZYrU9HXs9iMRmx+H8CDXNY8Jb_fFxxgPYw@mail.gmail.com>

> `head()` returns a problematic output when a character is fed to its `n`
> parameter.
> this can lead to an unexpected and inconsistent result.
> I would suggest either using `as.integer` consistently on the input, or
> having a consistent error for all character input.

I use the head() and tail() functions, a lot.
I agree that the argument checking and argument handling is not as good as
it could be.

In march I posted the following thread:
https://stat.ethz.ch/pipermail/r-devel/2019-March/077512.html
https://stat.ethz.ch/pipermail/r-devel/2019-March/077527.html

Perhaps, head (1:10, "foo"), should return a clear error message...
Then it's up to the user to convert strings to integers, if that's want he
or she wants to do.

	[[alternative HTML version deleted]]



[Rd] head with non integer n returns confusing output
Abby Spurdle