One thing is needed:
names(v) <- names(u)
PS:Thanks Mark Leeds
On 22/02/2008, Henrique Dallazuanna <[EMAIL PROTECTED]> wrote:
> Try this:
>
> sapply(names(u), function(x)u[x][u[x] >=min(v[x]) & u[x] <= max(v[x])])
>
>
> On 21/02/2008, dxc13 <[EMAIL PROTECTED]> wrote:
> >
> > useR's,
> >
You can do:
lapply2(u, v, function(u,v) u[inRange(u, range(v))])
using two functions 'lapply2' and 'inRange' defined at bottom.
This basically does:
lapply(seq(along=u),
function(i, U, V){
u <- U[[i]]
v <- V[[i]]
u
Try this:
sapply(names(u), function(x)u[x][u[x] >=min(v[x]) & u[x] <= max(v[x])])
On 21/02/2008, dxc13 <[EMAIL PROTECTED]> wrote:
>
> useR's,
>
> I want to apply this function to the columns of a data frame:
>
> u[u >= range(v)[1] & u <= range(v)[2]]
>
> where u is the n column data frame und
3 matches
Mail list logo