Julien Webb
Julien Webb

Reputation: 1

Ifelse temperature modelling

I am building a model in R and I have a data frame of daily temperature data in Kelvin (CSV file). I will run the model individually for each station. The literature I am basing the model off of states: when the temperature rises above 285.15, spawning is induced and ER is reduced to 0, meaning my graphical output should fall to zero and start climbing again after the temperature decreases. My question is this: How would I write this command into R? Thus far I have written:

spawn <- ER
spawning <- ifelse(Mussel_Daily_Temp$AS_TEMP > 285.15, ER-ER, 0)

I have also tried:

if(temperature > 285.15) {ER-ER}

My parameters look like this:

param <- list(Temperature = Mussel_Daily_Temp$AS_TEMP, etc....)

Any help would be most appreciated!

Upvotes: 0

Views: 71

Answers (1)

zdeeb
zdeeb

Reputation: 142

you are on the right path:

ifelse(Mussel_Daily_Temp$AS_TEMP > 285.15, 'ER-ER', 0)

Upvotes: 1

Related Questions