Looking at the documentation for try() I am not sure how it would be best
applied in this situation. My background is not extensively programming.
Would writing a function first be appropriate?

Also, I'm not sure just a simple error catch would solve my first problem.
I do, in fact, need it to plot the barplot based on the table which is
created above. However, R doesn't like the lack of several columns.

Further guidance would be appreciated.

--
all the best,
Lee Mueller
ISA Certified Arborist MI-4148A
Registered Forester #46043





On Wed, May 9, 2012 at 4:30 AM, Jim Holtman <jholt...@gmail.com> wrote:

> ?try
>
> Sent from my iPad
>
> On May 8, 2012, at 22:03, Lee <muell...@gmail.com> wrote:
>
> > I have a series of data which is managed through a loop. The loop creates
> > "pivot tables" of my data using the *cast* function in the
> > *reshape*library. For the most part, the data is all plotted
> > correctly.
> > Unfortunately, there are a couple of data sets which create errors and
> halt
> > the loop.
> >
> > One of the tables looks like the following:
> >
> >  dbh Black Walnut
> > 1   8     38.19722
> > 2  10     48.89244
> > 3  12     38.19722
> >
> > When the loop attempts the barplot() function, the following error is
> > returned:
> > Error in seq_len(p) : argument must be coercible to non-negative integer
> >
> > In other cases, there is simply no data in the specified set of data.
> > Therefore, the table is full of NA's. Obviously, this does not need to be
> > plotted, but I cannot simply remove it from the larger database. I need
> my
> > loop to continue regardless of if it runs into these issues.
> >
> > *Question: What can I do to ensure the above single variable table will
> > plot correctly? and what can I do to suppress errors on the datasets
> which
> > do not have data so the loop continues?*
> >
> > full code: http://pastebin.com/LB88hpfM
> >
> > Thank you in advance.
> >
> > --
> > all the best,
> > Lee Mueller
> > ISA Certified Arborist MI-4148A
> > Registered Forester #46043
> >
> >    [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > 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]]

______________________________________________
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.

Reply via email to