Thanks Duncan - that works perfectly.
--
View this message in context:
http://n4.nabble.com/colname-of-arguments-tp1588146p1589687.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/
On 11/03/2010 7:25 AM, ManInMoon wrote:
Duncan,
Thanks you - your deparse(substitute(...)) work - fantastic.
But, when I pass in multiple arguments: f(z[,1],z[,2])
I only show first argument, rest shows up as NULL
Yes, that's because substitute has specific meanings for its two
arguments
Duncan,
Thanks you - your deparse(substitute(...)) work - fantastic.
But, when I pass in multiple arguments: f(z[,1],z[,2])
I only show first argument, rest shows up as NULL
--
View this message in context:
http://n4.nabble.com/colname-of-arguments-tp1588146p1588872.html
Sent from the R help
mountain Healthcare
greg.s...@imail.org
801.408.8111
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of ManInMoon
> Sent: Thursday, March 11, 2010 1:34 AM
> To: r-help@r-project.org
> Subject: Re: [R] colname of .
ManInMoon wrote:
That is quite helpful David
niceplot<-function(...) {
parms=list(...)
for (x in parms) {
xname <- paste(deparse(substitute(x), 500), collapse = "\n")
cat(xname)
}
}
GreenEyes=c(1,2,3,4)
niceplot(GreenEyes)
c(1, 2, 3, 4)
BUT what I want is:
> GreenEyes=c
what about:
niceplot<-function(...) {
arg.names <- as.list (match.call () [-1])
for (a in seq_along (arg.names))
cat (as.character (as.expression (arg.names [[a]])), "\n\n")
}
niceplot (greeneye, log (greeneye), 1:3)
note that this works also if there is no "greeneye"
Disclaimer: I don't know
Hi
r-help-boun...@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
That is quite helpful David
niceplot<-function(...) {
parms=list(...)
for (x in parms) {
xname <- paste(deparse(substitute(x), 500), collapse = "\n")
cat(xname)
}
}
> GreenEyes=c(1,2,3,4)
> niceplot(GreenEyes)
c(1, 2, 3, 4)
>
BUT what I want is:
> GreenEyes=c(1,2,3,4)
> niceplot(GreenEy
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"...
O
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 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
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 l
12 matches
Mail list logo