Title: | Classes for Fitness Landscapes and Seascapes |
---|---|
Description: | Convenient classes to model fitness landscapes and fitness seascapes. A low-level package with which most users will not interact but upon which other packages modeling fitness landscapes and fitness seascapes will depend. |
Authors: | Raoul Wadhwa [aut, cre] , Jacob Scott [aut] |
Maintainer: | Raoul Wadhwa <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2024-10-31 21:12:59 UTC |
Source: | https://github.com/rrrlw/fitscape |
Get Dimensions of Fitness Landscape
dims(x)
dims(x)
x |
FitLandDF object |
integer vector analogous to 'base::dim'
# create flat fitness landscape with dimensions 3x3x3 values <- array(0, dim = rep(3, 3)) my_landscape <- FitLandDF(values) # print dimensions dims(my_landscape)
# create flat fitness landscape with dimensions 3x3x3 values <- array(0, dim = rep(3, 3)) my_landscape <- FitLandDF(values) # print dimensions dims(my_landscape)
Extract Data Frame Representation of Fitness Landscape
extract_df(x)
extract_df(x)
x |
FitLandDF object |
data frame representation of fitness landscape
# create fitness landscape values <- array(1:27, dim = rep(3, 3)) my_landscape <- FitLandDF(values) # extact data frame representation my_df <- extract_df(my_landscape)
# create fitness landscape values <- array(1:27, dim = rep(3, 3)) my_landscape <- FitLandDF(values) # extact data frame representation my_df <- extract_df(my_landscape)
Create New FitLandDF Instance
FitLandDF(scape_data, dims = dim(scape_data))
FitLandDF(scape_data, dims = dim(scape_data))
scape_data |
either data.frame or array object |
dims |
integer vector containing dimensions |
FitLandDF object
# create a flat fitness landscape with 3 binary (values 1 and 2) dimensions values <- array(2, dim = rep(2, 3)) my_landscape <- FitLandDF(values) # create a 2x2 fitness landscape that's highest when both dimensions are at 1 vals <- 1:2 df <- expand.grid(vals, vals) df$Landscape_value <- c(1, 2, 3, 6) my_landscape <- FitLandDF(df, dims = c(2L, 2L))
# create a flat fitness landscape with 3 binary (values 1 and 2) dimensions values <- array(2, dim = rep(2, 3)) my_landscape <- FitLandDF(values) # create a 2x2 fitness landscape that's highest when both dimensions are at 1 vals <- 1:2 df <- expand.grid(vals, vals) df$Landscape_value <- c(1, 2, 3, 6) my_landscape <- FitLandDF(df, dims = c(2L, 2L))
Confirm Object is Valid Instance of FitLandDF
is.FitLandDF(x) is_FitLandDF(x)
is.FitLandDF(x) is_FitLandDF(x)
x |
object whose class is in question |
'logical'; 'TRUE' if 'x' is an instance of FitLandDF, 'FALSE' otherwise
Get Highest and Lowest Fitness Values from Fitness Landscape
min_fit(x) max_fit(x)
min_fit(x) max_fit(x)
x |
FitLandDF object |
minimum or maximum fitness value in this landscape
# create fitness landscape with min value 1 and max value 27 values <- array(1:27, dim = rep(3, 3)) my_landscape <- FitLandDF(values) # calculate maximum fitness value max_fit(my_landscape) # calculate minimum fitness value min_fit(my_landscape)
# create fitness landscape with min value 1 and max value 27 values <- array(1:27, dim = rep(3, 3)) my_landscape <- FitLandDF(values) # calculate maximum fitness value max_fit(my_landscape) # calculate minimum fitness value min_fit(my_landscape)
Get Standard Deviation/Variance of Values in Fitness Landscape
variance(x, ...) sdev(x, ...)
variance(x, ...) sdev(x, ...)
x |
FitLandDF object |
... |
additional parameters (e.g. 'na.rm') |
variance or standard deviation of values in fitness landscape
# create fitness landscape with non-zero variance and standard deviation values <- array(1:27, dim = rep(3, 3)) my_landscape <- FitLandDF(values) # calculate variance variance(my_landscape) # calculate standard deviation sdev(my_landscape)
# create fitness landscape with non-zero variance and standard deviation values <- array(1:27, dim = rep(3, 3)) my_landscape <- FitLandDF(values) # calculate variance variance(my_landscape) # calculate standard deviation sdev(my_landscape)