[R] how to combine apply and which or alternative ways to do so
John Kane
jrkrideau at inbox.com
Sat Aug 24 14:41:42 CEST 2013
Bon jour,
I am not clear exactly what you are looking for. When I first read the email I though you wanted to know if something in vector 2 was in vector 1 but after rereading it I am not sure.
If I was correct the first time I think something like
vector2 %in% vector1
will do it.
If I am wrong, and I think I am, would you explain the problem a bit more, perhaps with some small data vectors?
John Kane
Kingston ON Canada
> -----Original Message-----
> From: balguillaume2883 at gmail.com
> Sent: Fri, 23 Aug 2013 14:37:26 -0700
> To: r-help at r-project.org
> Subject: [R] how to combine apply and which or alternative ways to do so
>
> Dear useRs,
>
> I am currently doing some data cleaning and data manipulation and I have
> the
> following problem.
> I have two vectors. Let say the size of the first one is 10 000 (vector
> 1)
> and the size of the second one is 1 000 000 (vector 2).
>
> I need to know for each cell of vector 1 which cells of vector 2
> correspond.
>
> I tried to combine the "which" and "apply" but I dit not succeed and I
> have no idea about a possible vectorization.
>
> Can someone help me ?
>
> Thanks
>
> Guillaume
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
____________________________________________________________
FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family!
Visit http://www.inbox.com/photosharing to find out more!
More information about the R-help
mailing list