Produces an object suitable to pass as the funcresp to spec_rescomp(). Creates a linear or type 1 functional response with attack rate a. mu_ij(R_j) = a_ij * R_j

funcresp_type1(a)

Arguments

a

A matrix or rescomp_coefs_matrix, with one row per species and one column per resource. The attack rate (if using efficiency) or growth rate (if using quota) of each species on each resource.

Value

S3 object of class rescomp_funcresp.

Examples

funcresp1 <- funcresp_type1(
  matrix(c(0.2, 0.4, 0.3, 0.2), nrow = 2)
)
get_funcresp(funcresp1, 2, c(10, 20), list())
#>      [,1] [,2]
#> [1,]    2    6
#> [2,]    4    4

funcresp2 <- funcresp_type1(
  rescomp_coefs_lerp(
    matrix(c(0.2, 0.4, 0.3, 0.2), nrow = 2),
    matrix(c(0.2, 0.1, 0.3, 0.1), nrow = 2),
    "antibiotic_concentration"
  )
)
get_funcresp(funcresp2, 2, c(10, 20), list(antibiotic_concentration = 0.5))
#>      [,1] [,2]
#> [1,]  2.0    6
#> [2,]  2.5    3