On Mon, 31 Oct 2016, Jeff Newmiller wrote:
The help page describes the first argument x as a numeric... it is not
designed to accept character,
Actually it is so designed, but not advertised as such. See below.
so the fact that you get anything even close to right is just a bonus.
As the do
> The help page describes the first argument x as a numeric...
It also describes the _value_ as numeric. One for the help page issue list?
In fact there seems no obvious reason for a hard restriction to numeric*; the
return value will depend largely on what FUN does, as there's no argument clas
s
> -Original Message-
> From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us]
> Sent: Monday, October 31, 2016 4:34 PM
> To: Nordlund, Dan (DSHS/RDA); r-help@r-project.org
> Subject: Re: [R] function ave() with seq_along returning char sequence
> instead of numeric
&
The help page describes the first argument x as a numeric... it is not designed
to accept character, so the fact that you get anything even close to right is
just a bonus.
As the doctor says, "if it hurts, don't do that".
ave( rep( 1, length( v ), v, FUN=seq_along )
--
Sent from my phone. Plea
Given the following R statements
v <- c('a', 'a', 'a', 'b', 'b', 'b', 'c', 'c', 'c', 'c')
ave(v, list(v), FUN=seq_along)
[1] "1" "2" "3" "1" "2" "3" "1" "2" "3" "4"
I was expecting to get a numeric vector back. I apparently have missed
something in the documentation. If vector v is charact
5 matches
Mail list logo