[R] Help with Names

2010-05-10 Thread Ravi Ramaswamy
Hi - a newbie question, if someone can please help I want to change X1, X2,,.to X.1 X.2 etc in the names below. I am using the Principal Component Regression function (pcr) and it seems to want it this way datap3.pcr - pcr(water ~ X, 10, data = datap3, Validation =cv) Error in

Re: [R] Help with Names

2010-05-10 Thread jim holtman
Is this what you want: x - paste(X, 1:10, sep='') x [1] X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 sub(X, X., x) [1] X.1 X.2 X.3 X.4 X.5 X.6 X.7 X.8 X.9 X.10 On Mon, May 10, 2010 at 8:53 PM, Ravi Ramaswamy raram...@gmail.com wrote: Hi - a newbie question, if someone can please

Re: [R] Help with Names

2010-05-10 Thread Ravi Ramaswamy
Jim - thanks. It worked, however pcr program is still not accepting it there is a sample yarn data loaded and I am comparing. My data looks like this X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17

Re: [R] Help with Names

2010-05-10 Thread jim holtman
You need to provide an 'str(yarn)' so we can see what the structure is. I don't know what the 'pcr' program is expecting, but it looks like from what you have provided that 'yarn' might be a dataframe and X is a vector. Look at the documentation for pcr and see what it expects. On Mon, May 10,

Re: [R] Help with Names

2010-05-10 Thread Ravi Ramaswamy
There is definitely a difference. The pcr program is Principal Component Regression, but document says The formula argument should be a symbolic formula of the form response ~ terms, where response is the name of the response vector or matrix (for multi-response models) and terms is the name of