Re: [R] function ave() with seq_along returning char sequence instead of numeric

2016-11-01 Thread Charles C. Berry
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

Re: [R] function ave() with seq_along returning char sequence instead of numeric

2016-11-01 Thread S Ellison
> 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

Re: [R] function ave() with seq_along returning char sequence instead of numeric

2016-10-31 Thread Nordlund, Dan (DSHS/RDA)
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 &

Re: [R] function ave() with seq_along returning char sequence instead of numeric

2016-10-31 Thread Jeff Newmiller
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

[R] function ave() with seq_along returning char sequence instead of numeric

2016-10-31 Thread Nordlund, Dan (DSHS/RDA)
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