Skip to contents

Load furniture for a given model.

Usage

load_furniture(model_name, path, file_name)

Arguments

model_name

the name given to the model used to store log information

path

list of useful paths

file_name

list of useful file_names

Value

a data.frame of furniture present in the model. If the file furniture.csv does not yet exist, return NULL. Some tries are made on format. First, 'furniture.csv' is supposed to be readable by utils::read.csv2, if not it is supposed to be readable by utils::read.csv. If not, an error is returned. User is asked to manage format on his own. Some tries are made on encoding. First, 'furniture.csv' is supposed to be encoded in UTF-8. If this try makes some error, another try is made in ISO-8859-15. If this second try does not work, an error is returned. User is asked to manage encoding on his own.

Examples


  model = "adu_t"
  type = "adu"

  load_furniture(
    model_name = model, 
    path = update_path(
      model = model, 
      type = type, 
      path = list(
        data = system.file("extdata", package = "floodam.building"), 
        output = tempdir()
      )
    ),
    file_name = init_file_name()
  )
#>      component_elementary     room_name wall_name relative_height dilapidation
#> 1                armchair        room_1        NA               0            0
#> 2  chipboard_coffee_table        room_1        NA               0            0
#> 3         chipboard_shelf        room_1        NA               0            0
#> 4         chipboard_shelf        room_3        NA               0            0
#> 5         chipboard_table        room_3        NA               0            0
#> 6         chipboard_chair        room_3        NA               0            0
#> 7    solid_wood_furniture        room_4        NA               0            0
#> 8         chipboard_shelf        room_4        NA               0            0
#> 9                    oven        room_4        NA               0            0
#> 10                 fridge        room_4        NA               0            0
#> 11            dish_washer        room_4        NA               0            0
#> 12        washing_machine        room_4        NA               0            0
#> 13              tableware        room_4        NA               0            0
#> 14          plastic_table external_wall        NA               0            0
#> 15          plastic_chair external_wall        NA               0            0
#>    quantity v_min v_max        details
#> 1         3   250   250       fauteuil
#> 2         2   100   100    table basse
#> 3         1   250   250        étagère
#> 4         2   250   250        étagère
#> 5         1   300   300          table
#> 6         6   100   100          table
#> 7         6   150   150      furniture
#> 8         2   250   250        étagère
#> 9         1   600   600           four
#> 10        1  1000  1000          frigo
#> 11        1  1000  1000 lave vaisselle
#> 12        1  1000  1000     lave-linge
#> 13        1   200   200      vaisselle
#> 14        1   200   200          table
#> 15        6   200   200          chair