I hate to decline such praise, but honesty demands that I must.
In fact, my solution is **not** fully vectorized at all! The tapply()
and mapply() calls are, in fact, in some sense hidden loops at the
interpreted levels. They do have the virtue of being true to R's
functional paradigm, but they ar
Dear Bert--
I tried your function on the data that I provided (data.df) and it worked
beautifully (after I added a missing final parenthesis), producing exactly
the same output as my function. This is an excellent example of what I was
looking for, because it is
(a) 50% shorter than mine,
Sorry, you **did** supply data and my solution **does** work (except I
left off 1 closing ")" .
> sq.n <- seq_len(nrow(data.df))
> tapply(sq.n,data.df$seq,function(x)with(data.df[x,],
+ sort(unique(do.call(c,mapply(seq,from=startNo,length=len,SIMPLIFY=FALSE))
$`1`
[1] 3 4 5 6 10 11
$`2`
[
I am not sure you have expressed what you wanjt to do correctly. See inline:
On Wed, Oct 10, 2012 at 9:10 PM, andrewH wrote:
> I have a couple of hundred American Community Survey Summary Files files
> containing rectangular arrays of data, mainly though not exclusively
> numeric. Each file is r
I have a couple of hundred American Community Survey Summary Files files
containing rectangular arrays of data, mainly though not exclusively
numeric. Each file is referred to as a sequence (henceforth "seq"). From
these files I am trying to extract particular subsets (tables) consisting of
a set
5 matches
Mail list logo