setCroptypes: Set croptypes

View source: R/Methods-LandsepiParams.R

setCroptypesR Documentation

Set croptypes

Description

Updates a LandsepiParams object with croptypes and their composition with regard to cultivar proportions

Usage

setCroptypes(params, dfCroptypes)

Arguments

params

a LandsepiParams Object.

dfCroptypes

a data.frame containing cultivar proportions in each croptype (see details). It can be generated manually, or initialised with loadCroptypes and later updated with allocateCroptypeCultivars.

Details

The data.frame for cultivar allocations into croptypes must take this format (example):

croptypeID croptypeName cultivarName1 cultivarName2 ...
0 "cropt1" 1 0 ...
1 "cropt2" 0.5 0.5 ...

croptypeIDs must start at 0 and match with values from landscape "croptypeID" layer with feature year_X. Cultivars names have to match cultivar names in the cultivars data.frame.

Value

a LandsepiParams object

See Also

loadCroptypes

Examples

## Not run: 
simul_params <- createSimulParams()
cultivar1 <- loadCultivar(name = "Susceptible", type = "growingHost")
cultivar2 <- loadCultivar(name = "Resistant1", type = "growingHost")
cultivar3 <- loadCultivar(name = "Resistant2", type = "growingHost")
cultivars <- data.frame(rbind(cultivar1, cultivar2, cultivar3), stringsAsFactors = FALSE)
simul_params <- setCultivars(simul_params, cultivars)
croptypes <- loadCroptypes(simul_params, names = c("Susceptible crop", "Mixture"))
croptypes <- allocateCroptypeCultivars(croptypes, "Susceptible crop", "Susceptible")
croptypes <- allocateCroptypeCultivars(croptypes, "Mixture", c("Resistant1", "Resistant2"))
simul_params <- setCroptypes(simul_params, croptypes)
simul_params@Croptypes

## End(Not run)

landsepi documentation built on July 26, 2023, 5:36 p.m.