Re: [R] Creating a sequence of variables in a data frame

2003-03-10 Thread Jason Turner
On Mon, Mar 10, 2003 at 08:14:54AM +, [EMAIL PROTECTED] wrote: On Mon, 10 Mar 2003, Jason Turner wrote: for(jj in 1:5) { foo[[jj + 1]] [which(foo$old == jj)] - TRUE #note - same offset #from above } You don't need the which(), as

Re: [R] Creating a sequence of variables in a data frame

2003-03-10 Thread Spencer Graves
data1 - data.frame(old=1:2) data1$old2 - 3:4 data1 old old2 1 13 2 24 Acceptable? Spencer Graves Ryan T. Moore wrote: Two questions: 1. I have a data frame named data1 that includes the variable old. I want to create a sequence of new variables in the data frame called old.1,

[R] Creating a sequence of variables in a data frame

2003-03-09 Thread Ryan T. Moore
Two questions: 1. I have a data frame named data1 that includes the variable old. I want to create a sequence of new variables in the data frame called old.1, old.2, ... . I've tried a few paste commands, and creating a new data frame of the new variables, all to no avail. Any advice? 2.