Skip to contents

Coarce variable to numeric or character

Usage

recode_var(
  x,
  to_num = c("plot", "tuber_size_mm", "rep", "row", "col", "yield"),
  to_char = c("flowering_date|obs|^note")
)

Arguments

x

a dataframe

to_num

columns to coerce to numeric

to_char

columns to coerce to character

Value

a dataframe

Examples

f <- system.file("uon-trial-1.csv", package = "pbwrangler")
df <- read_workbooks(dir = NULL, file_to_read = f) %>% `[[`(1)
#> 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_c <- recode_var(df)