[R] Column header strategy
David Winsemius
dwinsemius at comcast.net
Fri Jul 9 00:09:52 CEST 2010
On Jul 8, 2010, at 3:14 PM, Addi Wei wrote:
>
> Hopefully simple question: What is the best way to name, and treat
> factor
> columns for data that has lots of columns?
>
> This is my column list:
> id pID50 D.1 D.2 D.3 D.4 D.5 , etc. all the way to D.185
>
> I was under the impression from several R examples in pls that if
> you name
> your columns like above, you should be able to simply call all the D
> factors
> with "D", instead of going in and putting a plus sign between each
> column.
> miceD <- plsr(pID50~D, ncomp=10,data = micetitletest)
> Error in model.frame.default(formula = pID50 ~ D, data =
> micetitletest) :
> invalid type (closure) for variable 'D'
"D" is a function name. As are "c", "data", and "df"
>
> VS.
>
> miceD <- plsr(pID50 ~ D.1 + D.2 + D.3 + D.4 etc. to D.185 ,
> ncomp=10, data =
> micetitletest)
>
> What am I missing above that's causing that error message in bold?
> Is there
> a better strategy for naming my columns in order to make R use easier?
>
> --
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list