Skip to contents

compute derived phenotypic variables

Usage

run_data_processes(x, sz = 10, btwn = 0.75, within = 0.3, crop = "pt")

Arguments

x

a dataframe

sz

number of plants per plot

btwn

spacing between ridges in metres

within

spacing between plants in the same ridge in metres

crop

one of 'pt' or 'sp'

Value

a dataframe

Examples

f <- system.file("uon-trial-1.csv", package = "pbwrangler")
df <- read_workbooks(dir = NULL, file_to_read = f)  %>%
  purrr::map(
    .,
    ~ dplyr::mutate(
      .,
      space_between_ridges = "0.75m",
      space_between_plants_in_ridges = "0.3m",
      number_of_plants_per_plot = 10
    )
  )
#> Rows: 108 Columns: 32
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr  (8): unique, geno, flowering_date, flower_colour, flesh_colour, skin_co...
#> dbl (24): plot, entry, row, col, rep, ntp, npe, growth_speed, pgh, plant_uni...
#> 
#>  Use `spec()` to retrieve the full column specification for this data.
#>  Specify the column types or set `show_col_types = FALSE` to quiet this message.

df_out <- pre_process_trials(df) |> process_trials() %>%
  purrr::map(., run_data_processes)
#> Warning: NAs introduced by coercion
#> Warning: NAs introduced by coercion
#> Warning: NAs introduced by coercion
#> Warning: NAs introduced by coercion
#> Warning: NAs introduced by coercion
#> Warning: NAs introduced by coercion
#> Warning: NAs introduced by coercion
#> Warning: NAs introduced by coercion
#> Warning: NAs introduced by coercion
#> Warning: NAs introduced by coercion
#> Warning: NAs introduced by coercion
#> Joining with `by = join_by(old_family_code)`
#> Warning: Some columns with invalid names: c("unique", "entry", "growth_speed", "flowering_date", "flower_colour", "overall_impression", "flesh_colour", "skin_colour", "late_blight_60_days", "obs", "photo", "space_between_ridges", "space_between_plants_in_ridges", "number_of_plants_per_plot", "n_tubers", "pls", "pld")
#> Warning: Some columns with invalid names: c("unique", "entry", "growth_speed", "flowering_date", "flower_colour", "overall_impression", "flesh_colour", "skin_colour", "late_blight_60_days", "obs", "photo", "space_between_ridges", "space_between_plants_in_ridges", "number_of_plants_per_plot", "n_tubers", "pls", "pld")
#> Warning: Some columns with invalid names: c("unique", "entry", "growth_speed", "flowering_date", "flower_colour", "overall_impression", "flesh_colour", "skin_colour", "late_blight_60_days", "obs", "photo", "space_between_ridges", "space_between_plants_in_ridges", "number_of_plants_per_plot", "n_tubers", "pls", "pld")
#> Warning: Rows with out of scale values replaced with NA for variable nmtp: 54 
#> Warning: Rows with out of scale values replaced with NA for variable ppe: 1 2 3 4 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 
#> Warning: Rows with extreme values replaced with NA for variable atmw: 54 
#> Warning: Rows with extreme values replaced with NA for variable mtwp: 54 
#> Warning: Rows with extreme values replaced with NA for variable mtyna: 54 
#> Warning: Rows with extreme values replaced with NA for variable ttwp: 54 
#> Warning: Rows with extreme values replaced with NA for variable ttyna: 54 
#> Warning: Some columns with invalid names: c("unique", "entry", "growth_speed", "flowering_date", "flower_colour", "overall_impression", "late_blight_60_days", "obs", "photo", "space_between_ridges", "space_between_plants_in_ridges", "number_of_plants_per_plot", "n_tubers", "pls", "pld")
#> Warning: Some variables have been overwritten: c("atmw", "atw", "ppe", "mtyna", "ttyna")
#> Warning: Some columns with invalid names: c("unique", "entry", "growth_speed", "flowering_date", "flower_colour", "overall_impression", "late_blight_60_days", "obs", "photo", "space_between_ridges", "space_between_plants_in_ridges", "number_of_plants_per_plot", "n_tubers", "pls", "pld")
#> Warning: Rows with out of scale values replaced with NA for variable ppe: 1 2 3 4 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 
#> Warning: Rows with out of scale values replaced with NA for variable tbfsh1: 1 2 3 4 5 6 19 20 21 22 23 24 37 38 39 40 41 42 55 56 57 58 59 60 73 74 75 76 77 78 91 92 93 94 95 96 
#> Warning: Rows with out of scale values replaced with NA for variable tbskn1: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 
purrr::map(df_out, names_df)
#> $`UON-TRIAL-1`
#>  [1] "atmw"                           "atw"                           
#>  [3] "col"                            "entry"                         
#>  [5] "flower_colour"                  "flowering"                     
#>  [7] "flowering_date"                 "geno"                          
#>  [9] "growth_speed"                   "late_blight_60_days"           
#> [11] "mtwp"                           "mtyna"                         
#> [13] "n_tubers"                       "nmtp"                          
#> [15] "npe"                            "ntp"                           
#> [17] "number_of_plants_per_plot"      "obs"                           
#> [19] "overall_impression"             "pgh"                           
#> [21] "photo"                          "plant_unif"                    
#> [23] "plant_vigor"                    "pld"                           
#> [25] "plot"                           "pls"                           
#> [27] "ppe"                            "rep"                           
#> [29] "row"                            "se"                            
#> [31] "space_between_plants_in_ridges" "space_between_ridges"          
#> [33] "tbfsh1"                         "tbskn1"                        
#> [35] "tntp"                           "ttwp"                          
#> [37] "ttyna"                          "tub_size"                      
#> [39] "tub_unif"                       "tuber_apper"                   
#> [41] "unique"                        
#>