[R] colname of ... arguments
Petr PIKAL
petr.pikal at precheza.cz
Thu Mar 11 11:07:25 CET 2010
Hi
r-help-bounces at r-project.org napsal dne 11.03.2010 09:34:06:
>
> David,
>
> That's useful to highlight my problem.
> If instead of e="e" we use a vector like GreenEyes:
>
> > GreenEyes=c(1,2,3,4)
> > niceplot(GreenEyes)
> 1 2 3 4
> >
>
> What I want is niceplot to print "GreenEyes" bot 1 2 3 4
>
> I want this so I can use it in a legend without having to type in
> "GreenEyes"...
But where is GreenEyes? If it is a name in data.frame or list you can
access it with any standard extraction ways, like names, colnames, "[".
If it is an object in environment them ls() or ls.str() could be used.
but in any case you would need to tell R which object/name use. The mind
reading package is AFAIK still only in its beta versions.
Regards
Petr
>
>
> On 10 March 2010 23:32, David Winsemius [via R] <
> ml-node+1588214-2107833523-180445 at n4.nabble.com<ml-node%
> 2B1588214-2107833523-180445 at n4.nabble.com>
> > wrote:
>
> > I think you need to provide a richer example:
> >
> > niceplot<-function(...) {
> > parms=list(...)
> >
> > for (x in parms) {
> > cat(x)
> > }
> > }
> > > e="e"
> >
> > > niceplot(e)
> > e
> >
> > On Mar 10, 2010, at 5:21 PM, ManInMoon wrote:
> >
> > >
> > > I have writtn a function where I pass a variable number of
arguments.
> > >
> > > I They are vectors and I can manipulate them, but I need to get hold
> > > of the
> > > name for a legend.
> > >
> > > niceplot<-function(...) {
> > > parms=list(...)
> > >
> > > for (x in parms) {
> > > DoSomethingWith(x)
> > > }
> > >
> > > }
> > >
> > > BUT how how can I get something like namestring(...) of
> > > nameofvector(x)?
> > > --
> > > View this message in context:
> > http://n4.nabble.com/colname-of-arguments-tp1588146p1588146.html
> > > Sent from the R help mailing list archive at Nabble.com.
> > >
> > > ______________________________________________
> > > [hidden email]<
http://n4.nabble.com/user/SendEmail.jtp?type=node&node=1588214&i=0
> >mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html<http://www.r-project.org/
> posting-guide.html>
> > > and provide commented, minimal, self-contained, reproducible code.
> >
> > ______________________________________________
> > [hidden email]<
http://n4.nabble.com/user/SendEmail.jtp?type=node&node=1588214&i=1
> >mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html<http://www.r-project.org/
> posting-guide.html>
> > and provide commented, minimal, self-contained, reproducible code.
> >
> >
> > ------------------------------
> > View message @
> > http://n4.nabble.com/colname-of-arguments-tp1588146p1588214.html
> > To unsubscribe from colname of ... arguments, click here< (link
removed) ==>.
> >
> >
> >
>
> --
> View this message in context: http://n4.nabble.com/colname-of-arguments-
> tp1588146p1588605.html
> Sent from the R help mailing list archive at Nabble.com.
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
More information about the R-help
mailing list