Re: [R] Repeating lines in a data frame

2005-10-18 Thread Sundar Dorai-Raj
Guenther, Cameron wrote: > Hello, > I have a much larger dataset that is similar in form to: > year species length count > 1998 1150 1 > 1998 2200 1 > 1998 3250 2 > 1999 1150 3 > 1999 2200 4 > 1999 3250 5 >

Re: [R] Repeating lines in a data frame

2005-10-18 Thread jim holtman
Try this: > x year species length count 1 1998 1 150 1 2 1998 2 200 1 3 1998 3 250 2 4 1999 1 150 3 5 1999 2 200 4 6 1999 3 250 5 7 2000 1 150 1 8 2000 2 200 1 9 2000 3 250 1 10 2001 1 150 2 11 2001 2 200 3 12 2001 3 250 1 13 2002 1 150 1 14 2002 2 200 2 15 2002 3 250 3 > y <- unlist(lapply(seq(nr

Re: [R] Repeating lines in a data frame

2005-10-18 Thread Martin Henry H. Stevens
See ?order, e.g., (a <- expand.grid(1998:2000,1:2,1:3)) attach(a) (b <- a[order(Var1,Var3,Var2),]) Hank On Oct 18, 2005, at 3:20 PM, Guenther, Cameron wrote: > Hello, > I have a much larger dataset that is similar in form to: > year species length count > 1998 1150 1 > 1998

[R] Repeating lines in a data frame

2005-10-18 Thread Guenther, Cameron
Hello, I have a much larger dataset that is similar in form to: year species length count 1998 1150 1 1998 2200 1 1998 3250 2 1999 1150 3 1999 2200 4 1999 3250 5 2000 1150 1 2000 220