No this doesn't seem like what I want.

As you can see in the dataset sometimes there are the same species on
different locations. First I want to make a chart on how many of a single
species there are in this dataset and preferrably for all species in one
chart.

Second I want to make such a chart per Location or Station as called in the
data set and third such a chart per Sa.Code

Gr,
Marcella

2012/11/15 Berend Hasselman <bhh@xs4all.nl>

>
> On 15-11-2012, at 11:14, Gaj Stan (BIGCAT) wrote:
>
> > Hello all,
> >
> > I have the following problem:
> >
> > 1) A list was defined as 'a'
> >
> > a <- list("var1"=c(100:1), "var2"=c(1:100), "var3"=rnorm(100))
> >
> > 2) a function 'foo' was defined that extracts the variable name assigned
> to x using the deparse(substitute()) functionality. This name will then be
> used within the function to generate specific output files, etc.
> >
> > foo <- function(x) {
> >  print( deparse(substitute(x)) )
> > }
> >
> > However, I am currently interested in looping through all list variables
> and extract the list variable name from within the function. The current
> loop (see below) will result in
> >
> > for(i in 1:length(a)) {
> >  foo(a[[i]])
> > }
> > [1] "a[[i]]"
> >
> > which actually does what I expected of deparse(substitute(x)), but is
> not what I wanted. I would like to end up with something like
> >
> > [1] "var1"
> > [1] "var2"
> > [1] "var3"
> >
> > or
> >
> > [1] "a[[\"var1\"]]"
> > [1] "a[[\"var2\"]]"
> > [1] "a[[\"var3\"]]"
> >
> > Keep in mind that x has to be a matrix, and not a list. This to keep the
> function as general as possible.
> >
> > Does anyone have any idea on how to tackle this? Is
> deparse(substitute(x)) here the best way to go? Are there alternatives?
>
> I'm not sure if I understand what you want but will this give you what you
> seem to want:
>
> names(a)
>
> Berend
>
> ______________________________________________
> R-help@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.
>

	[[alternative HTML version deleted]]


