[R] evaluate a series of equations for a vector

From: Benjamin Caldwell <btcaldwell_at_berkeley.edu>
Date: Tue, 12 Apr 2011 22:54:12 -0700


Hi folks,
I have a script that will evaluate a single equation for a vector and write graphs to a folder:



species.name="CussoniaHolstii"
dia<-10:100
biomass.equals<-21.4863 + 0.5797 * (dia ^ 2) jpeg(paste(species.name, '.jpg', sep = '')) plot (biomass.equals, main=species.name, xlab="dbh in cm", ylab="biomass in kg")
dev.off()

I have a table that includes vectors species.name and biomass.equals, which are as you see examples above, a series of names and a corresponding equation.

I would like R to evaluate each biomass equation for each species by the variable it contains, dia, but when importing the .csv the "biomass.equals" field is read as a factor. Is there a way to coerce R to read each equation as it reads it in the above code, as an equation that contains a variable? Perhaps something in methods(as)? Is there a help file for each of those? Or should I do something altogether different?

Appreciate any help.

Best

*Ben Caldwell*

        [[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. Received on Wed 13 Apr 2011 - 05:59:30 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 13 Apr 2011 - 07:50:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive