Getting parameters data from tables files (Excel sheet, csv)

read_params_table(
  file,
  sheet_name = NULL,
  num_na = "NA",
  char_na = "NA",
  file_path = lifecycle::deprecated()
)

Arguments

file

Excel or csv file path (including name of the file)

sheet_name

Name of an Excel sheet (useless for csv files)

num_na

Replacement value for numerical NA values (default: NA)

char_na

Replacement value for character NA values (default: "")

file_path

[Deprecated] file_path is no longer supported, use file instead.

Value

A tibble of parameters

Details

After data are loaded, numerical and string NA values are replaced respectively with num_na or char_na

Examples


usm_xl_file <- download_usm_xl(
  file = "inputs_stics_example.xlsx",
  verbose = FALSE
)
#> Warning: inputs_stics_example.xlsx already exists in  /var/folders/1y/56hdyx6x0_jb18k7b4ys9b6w0000gn/T//Rtmp6TMon6 
#> Consider to set overwrite = TRUE to overwrite (it | them )
read_params_table(usm_xl_file, sheet = "USMs")
#> # A tibble: 12 × 19
#>    usm_name      datedebut datefin finit nomsol fstation fclim1 fclim2 culturean
#>    <chr>         <chr>     <chr>   <chr> <chr>  <chr>    <chr>  <chr>  <chr>    
#>  1 USM_2017_T1_… 199       263     USM_… USM_T1 climate… clima… clima… 1        
#>  2 USM_2018_T1   264       570     USM_… USM_T1 climate… clima… clima… 2        
#>  3 BIN_CAN_05_S… 199       263     Vill… LF1    climate… clima… clima… 2        
#>  4 BIN_AGT_04_I… 264       570     Vill… LF1    climate… clima… clima… 2        
#>  5 AGA_ARB_13_I… 199       263     Vill… LF1    climate… clima… clima… 2        
#>  6 AGA_ARB_13_S… 264       570     Vill… LF1    climate… clima… clima… 2        
#>  7 FRA_ARB_11_S… 199       263     Vill… LF1    climate… clima… clima… 2        
#>  8 MAG_ARB_09_S… 264       570     Vill… LF1    climate… clima… clima… 2        
#>  9 MAG_ARV_12_I… 199       263     Vill… LF1    climate… clima… clima… 2        
#> 10 MAG_ARV_12_S… 264       570     Vill… LF1    climate… clima… clima… 2        
#> 11 FRA_ARB_12_S… 199       263     Vill… LF1    climate… clima… clima… 2        
#> 12 FRA_ARB_13_S… 264       570     Vill… LF1    climate… clima… clima… 2        
#> # ℹ 10 more variables: nbplantes <chr>, codesimul <chr>, fplt_1 <chr>,
#> #   ftec_1 <chr>, flai_1 <chr>, fobs_1 <chr>, fplt_2 <chr>, ftec_2 <chr>,
#> #   flai_2 <chr>, fobs_2 <chr>
usm_csv_file <- download_usm_csv(
  file = "inputs_stics_example_USMs.csv",
  verbose = FALSE,
  stics_version = "V9.2"
)
#> Warning: inputs_stics_example_USMs.csv already exists in  /var/folders/1y/56hdyx6x0_jb18k7b4ys9b6w0000gn/T//Rtmp6TMon6 
#> Consider to set overwrite = TRUE to overwrite (it | them )
read_params_table(file = usm_csv_file)
#> # A tibble: 12 × 19
#>    usm_name      datedebut datefin finit nomsol fstation fclim1 fclim2 culturean
#>    <chr>         <chr>     <chr>   <chr> <chr>  <chr>    <chr>  <chr>  <chr>    
#>  1 USM_2017_T1_… 199       263     USM_… USM_T1 climate… clima… clima… 1        
#>  2 USM_2018_T1   264       570     USM_… USM_T1 climate… clima… clima… 2        
#>  3 BIN_CAN_05_S… 199       263     Vill… LF1    climate… clima… clima… 2        
#>  4 BIN_AGT_04_I… 264       570     Vill… LF1    climate… clima… clima… 2        
#>  5 AGA_ARB_13_I… 199       263     Vill… LF1    climate… clima… clima… 2        
#>  6 AGA_ARB_13_S… 264       570     Vill… LF1    climate… clima… clima… 2        
#>  7 FRA_ARB_11_S… 199       263     Vill… LF1    climate… clima… clima… 2        
#>  8 MAG_ARB_09_S… 264       570     Vill… LF1    climate… clima… clima… 2        
#>  9 MAG_ARV_12_I… 199       263     Vill… LF1    climate… clima… clima… 2        
#> 10 MAG_ARV_12_S… 264       570     Vill… LF1    climate… clima… clima… 2        
#> 11 FRA_ARB_12_S… 199       263     Vill… LF1    climate… clima… clima… 2        
#> 12 FRA_ARB_13_S… 264       570     Vill… LF1    climate… clima… clima… 2        
#> # ℹ 10 more variables: nbplantes <chr>, codesimul <chr>, fplt_1 <chr>,
#> #   ftec_1 <chr>, flai_1 <chr>, fobs_1 <chr>, fplt_2 <chr>, ftec_2 <chr>,
#> #   flai_2 <chr>, fobs_2 <chr>