[R-sig-eco] Capture data

Allan Edelsparre a.edelsparre at utoronto.ca
Wed Feb 8 21:43:26 CET 2017


Hi all,

I have two data sets I want to merge. One has a vector with trap IDs and the vector from the other data set has the number of individuals captured at each trap site. I need to reverse the trap ID's within the trap ID vector in order to match the number trapped. Here is an example of how the vector looks like:

TrapID
A01
B01
C01
A02
B02
C02
A03
B03
C03

I need the vector to look like this

C01
B01
A01
C02
B02
A02
C03
B03
A03

I can do the first chunk using this code:

rev(TrapID[seq(1, 3)])

I've tried several versions of this code including doing a for loop where I ran each sequence through, but it never worked. Any thoughts as to how I can do the reversal of a sequence within my vector???

Allan

	[[alternative HTML version deleted]]



More information about the R-sig-ecology mailing list