You may find the forumula syntax

        y ~ .

helpful. If data= is supplied to the modeling command, the single period means 'all variables in the data frame that are not otherwised mentioned.

As for changing he names on an existing object, you can't use the rownames(x) <- foo syntax trick in python. Internally R converts function calls of this sort to

        "[<-rownames"(x, foo)

Given this fact, you can use

        x <- r("[<-rownames")(x, foo)

to change the rownames.

-G





On Jun 8, 2008, at 4:30PM , Laurent Gautier wrote:

2008/6/7  <[EMAIL PROTECTED]>:
> Hi Guys, sorry for the uninformative title.
>
> Basically If folk remember I am wanting to do some PLS regression on some > data. Folk on this list were kind enough to point me in the direction of > how to do this and I seem to have hit a really simple error which has
> gorund me to a halt. So any chance of a shove in the right direction
> basically
>
> plsr takes ("response ~ data") as formula I have data imported as a
> dataframe, this was imporrted from CSV with no header so my column names
> are V1 to V83
>
> I can force a PLSR by doing ("V83 ~ V1+V2+v3.....+v82") but i would rather > have this in the form of ("response ~ data") (because i'm going to do some
> PLR predictions on generated data sets later)
>
> So I want to name V83 responseACC and V1:V82 dataACC so that my plsr
> equation can be ("responseACC  ~ dataACC")

That does not quite work this way in R, I think. This is becoming more
a R question,
so r-help is probably a better place (although I could already hint
you that studying the
example for "plsr" should be helpful ;-) ).

> I have tried various solutions to this the closest I get is listed below
> but for some reason it doesn't want to do what I think it should do.
>
> when I print r.names I get V83 called err V83 and dataACC called
> dataACC.V1....dataACC.V82 which is really confusing; and probably where
> the fault lies.
>
> Can I do this?
>
> If I can't do this then, I tried doing...
> r.names(accFASdf) = r.c(
> "V1","V2","V3","V4","V5","V6","V7","V8","V9","V10","V11","V12","","V13 ","V14","V15","V16","V17","V18","V19","V20","V21","V22","V23","V24","" ,"V25","V26","V27","V28","V29","V30","V31","V32","V33","V34","V35","V3 6","","V37","V38","V39","V40","V41","V42","V43","V44","V45","V46","V47 ","V48","","V49","V50","V51","V52","V53","V54","V55","V56","V57","V58" ,"V59","V60","","V61","V62","V63","V64","V65","V66","V67","V68","V69", "V70","V71","V72","","V73","V74","V75","V76","V77","V78","V79","V80"," V81","V82"
> )
>
> to name the column names of my generated dataframe accFASdf the same as I
> get on import of my training set but that gives me the error
>
> SyntaxError: can't assign to function call
>
> Thanks in advance for any help
>
> Chris
>
> import rpy
> from rpy import *
>
> from UserString import MutableString
>
>
>
> r.library('pls')
> # need to change the conversion mode here so mod keeps it's R- nature:
> rpy.set_default_mode(rpy.NO_CONVERSION)
>
> dataPLS1=r.read_csv('acc-with-values.csv', header = 0, sep = ',',
> quote='\"', dec=".", fill = 1)
>
>
> dataPLS = r.as_data_frame({'dataACC': dataPLS1[1:81],'responseACC':
> dataPLS1[82]})
> r.print_(r.names(dataPLS))
>
>
>
> mod=r.plsr(r("responseACC ~ dataACC"),ncomp=10,data=dataPLS,validation="CV")
>
> Error: responseACC not found
>
>
> mod=r.plsr(r("V83 ~ dataACC"),ncomp=10,data=dataPLS,validation="CV")
>
> Error: dataACC not found
>
>
>
> ---------------------------------------------------------------------- ---
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> rpy-list mailing list
> rpy-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rpy-list
>

---------------------------------------------------------------------- ---
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to