Re: [R] iterative using values from a data frame to parameterize a function

2011-07-30 Thread David Winsemius
On Jul 30, 2011, at 5:13 AM, Dennis Murphy wrote: Hi: Try this: set.seed(266) dfm <- data.frame(c1 = sample(1:5, 10, replace = TRUE), e1 = sample(1:3, 10, replace = TRUE), c2 = sample(1:5, 10, replace = TRUE), e2 = sample(1:3, 10, replace = T

Re: [R] iterative using values from a data frame to parameterize a function

2011-07-30 Thread Dennis Murphy
Hi: Try this: set.seed(266) dfm <- data.frame(c1 = sample(1:5, 10, replace = TRUE), e1 = sample(1:3, 10, replace = TRUE), c2 = sample(1:5, 10, replace = TRUE), e2 = sample(1:3, 10, replace = TRUE), c3 = sample(1:5, 10, replac

Re: [R] iterative using values from a data frame to parameterize a function

2011-07-30 Thread Benjamin Caldwell
test<-by(vol,x, vol.exp) Error in tapply(1L:45L, list(DBH = 80:200), function (x) : arguments must have same length *Ben * On Sat, Jul 30, 2011 at 10:16 AM, Benjamin Caldwell wrote: > Or maybe that function should look more like > > vol.exp<-function(x) { > V<-((coefficient1*(x)^exponent1)

Re: [R] iterative using values from a data frame to parameterize a function

2011-07-30 Thread Benjamin Caldwell
Or maybe that function should look more like vol.exp<-function(x) { V<-((coefficient1*(x)^exponent1)+(coefficient2*(x)^exponent2)+constant) V } ? *Ben * On Sat, Jul 30, 2011 at 10:06 AM, Benjamin Caldwell wrote: > Hello, > > I'm just trying to wrap my head around the syntax for creating loop

[R] iterative using values from a data frame to parameterize a function

2011-07-30 Thread Benjamin Caldwell
Hello, I'm just trying to wrap my head around the syntax for creating loops, functions in R. I have an array of values from a .csv. Looks something like header<-c(species,coefficient1, exponent1, coefficient2, exponent2, constant) with a species name for the first column, and values for coeffici