[R] Odp: data frame titles

From: Petr PIKAL <petr.pikal_at_precheza.cz>
Date: Wed, 04 Jun 2008 13:11:47 +0200

Hi

r-help-bounces_at_r-project.org napsal dne 04.06.2008 10:57:26:

> I'm new to R so please forgive the newbie question; but i can't seem to
> find a definitive answer to this.
>
> I am wanting to do a PLS regression on some data. Which takes a formula
> of the type
> "responseACC ~ dataACC"
>
> where dataACC is multivariate in nature and responseACC is a single
value.

Really? From which package? AFAIK in package pls you have to enter formula plsr(response~terms, data.frame)

>
> I have imported my data from a csv file into a dataframe called for
> arguments sake df.
> This file has no headers in it so I get column names X1.....X83
>
> I then create a new data frame which says
> data.frame(dataACC = df[1:82], responseACC = df[83])

You probably want
data.frame(dataACC = df[,1:82], responseACC = df[,83])

>
> When I look at the names of this though I get...
>
> dataACC.X1 ..... dataACC.X82 and then X83
>
> When I pass this to the PLS algorithm I get the error
>
> "variable responseACC not found"
>
> So a few questions, Am I doing this in the right way in general? why is
> the responseACC not being associated as the name of df[83]?
>
> Thirdly, If I want to generate my own array of values in order to do get

> a predicted response based on my initial PLS regression, will it matter
> that the array data will not have header values (eg dataACC.X1 etc)? if
> so what the best way of appending the header data?

see ?names

Regards
Petr

>
> Thanks for any help you can lend
>
> Chris
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 04 Jun 2008 - 11:17:22 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 04 Jun 2008 - 12:30:41 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive