# Create a function that estimates energy use ( ), and % development completed ( ) for any hour of embryo development.

Hi,
I am trying to create a function that uses three functions that I created before. These functions are:

1. t <- sum(x + 6)
Tave <- mean(t)
A <- (1/2) * (t)

SST = function(t = (x + 6), Tave = mean(t), A = (0.5(t-8))) {
A * sin((6.283/24) * (t + 6 - 8)) + Tave
}

# Estimates hourly temperature of soil at any time point in the day (ºC)

1. Energy <- function(temp_c) {
temp_k <- temp_c + 273
Energy <- exp(-8.74901e-20 / (1.3806488e-23 * temp_k) + 21.44)
print(Energy)
}

# Estimates energy expenditure of an embryo at any time point in the day (Joules/hour)

3)devtemp <- t

DevRate <- function(devtemp) {
if(devtemp <= 15.9) {
D == 0
} else {
((-0.024545 + 0.001545 * devtemp) / 24) * 100
}
}

# Estimate embryo development rate (%/h)

The new function I am trying to create uses these functions to estimate soil surface temperature in ºC, energy expenditure (E) in J (based on soil surface temperature for any hour < t >), and % development completed (D)(based on soil surface temperature for any hour < t >). The expected outputs I need use t = 7, Tave = 28, and A = 5 to produce two values: 2.0538 and 0.1091. I don't know how to structure this function so any help would be appreciated.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.