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.

Details

Some tries are made on format:

  1. First, 'furniture.csv' is supposed to be readable by utils::read.csv2.

  2. If not it is supposed to be readable by utils::read.csv.

  3. If not, an error is returned. User is asked to manage format on his own.

Some tries are made on encoding:

  1. First, 'furniture.csv' is supposed to be encoded in UTF-8.

  2. If this try makes some error, another try is made in ISO-8859-15.

  3. 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
#> 1                          armchair    room_1      <NA>               0
#> 2            chipboard_coffee_table    room_1      <NA>               0
#> 3                   chipboard_shelf    room_1      <NA>               0
#> 4                   chipboard_shelf    room_3      <NA>               0
#> 5                   chipboard_table    room_3      <NA>               0
#> 6                   chipboard_chair    room_3      <NA>               0
#> 7              solid_wood_furniture    room_4      <NA>               0
#> 8                   chipboard_shelf    room_4      <NA>               0
#> 9                              oven    room_4      <NA>               0
#> 10                           fridge    room_4      <NA>               0
#> 11                      dish_washer    room_4      <NA>               0
#> 12                  washing_machine    room_4      <NA>               0
#> 13                        tableware    room_4      <NA>               0
#> 14                    plastic_table  external    wall_D               0
#> 15                    plastic_chair  external    wall_D               0
#> 16 external_air_conditioning_system  external    wall_C              30
#>    dilapidation quantity v_min v_max                        details     room
#> 1             0        3   250   250                       fauteuil   room_1
#> 2             0        2   100   100                    table basse   room_1
#> 3             0        1   250   250                        etagere   room_1
#> 4             0        2   250   250                        etagere   room_3
#> 5             0        1   300   300                          table   room_3
#> 6             0        6   100   100                          table   room_3
#> 7             0        6   150   150                      furniture   room_4
#> 8             0        2   250   250                        etagere   room_4
#> 9             0        1   600   600                           four   room_4
#> 10            0        1  1000  1000                          frigo   room_4
#> 11            0        1  1000  1000                 lave vaisselle   room_4
#> 12            0        1  1000  1000                     lave-linge   room_4
#> 13            0        1   200   200                      vaisselle   room_4
#> 14            0        1   200   200                          table external
#> 15            0        6   200   200                          chair external
#> 16            0        1  1500  2000 groupe extérieur climatisation external
#>      wall  H
#> 1    <NA>  0
#> 2    <NA>  0
#> 3    <NA>  0
#> 4    <NA>  0
#> 5    <NA>  0
#> 6    <NA>  0
#> 7    <NA>  0
#> 8    <NA>  0
#> 9    <NA>  0
#> 10   <NA>  0
#> 11   <NA>  0
#> 12   <NA>  0
#> 13   <NA>  0
#> 14 wall_D  0
#> 15 wall_D  0
#> 16 wall_C 30