my_age returns amount of vehicles at each age using a numeric vector.

my_age(x, y, agemax, name = "vehicle", k = 1, pro_street, net,
verbose = FALSE, namerows)

Arguments

x Numeric; vehicles by street (or spatial feature). Numeric or data.frame; when pro_street is not available, y must be 'numeric', else, a 'data.frame'. The names of the columns of this data.frame must be the same of the elements of pro_street and each column must have a profile of age of use of vehicle. When 'y' is 'numeric' the vehicles has the same age distribution to all street. When 'y' is a data.frame, the distribution by age of use varies the streets. Integer; age of oldest vehicles for that category Character; of vehicle assigned to columns of dataframe. Integer; multiplication factor. If its length is > 1, it must match the length of x Character; each category of profile for each street. The length of this character vector must be equal to the length of 'x'. The names of the data.frame 'y' must be have the same content of 'pro_street' SpatialLinesDataFrame or Spatial Feature of "LINESTRING" Logical; message with average age and total numer of vehicles. Any vector to be change row.names. For instance, name of regions or streets.

Value

dataframe of age distrubution of vehicles.

Note

The functions age* produce distribution of the circulating fleet by age of use. The order of using these functions is:

1. If you know the distribution of the vehicles by age of use , use: my_age 2. If you know the sales of vehicles, or (the regis)*better) the registry of new vehicles, use age to apply a survival function. 3. If you know the theoretical shape of the circulating fleet and you can use age_ldv, age_hdv or age_moto. For instance, you dont know the sales or registry of vehicles, but somehow you know the shape of this curve. 4. You can use/merge/transform/adapt any of these functions.

Examples

{ data(net) dpc <- c(seq(1,20,3), 20:10) PC_E25_1400 <- my_age(x = net$ldv, y = dpc, name = "PC_E25_1400") class(PC_E25_1400) plot(PC_E25_1400) PC_E25_1400sf <- my_age(x = net$ldv, y = dpc, name = "PC_E25_1400", net = net) class(PC_E25_1400sf) plot(PC_E25_1400sf) PC_E25_1400nsf <- sf::st_set_geometry(PC_E25_1400sf, NULL) class(PC_E25_1400nsf) yy <- data.frame(a = 1:5, b = 5:1) # perfiles por categoria de calle pro_street <- c("a", "b", "a") # categorias de cada calle x <- c(100,5000, 3) # vehiculos my_age(x = x, y = yy, pro_street = pro_street) }
#> #> Average = 10.21
#> Warning: plotting the first 9 out of 18 attributes; use max.plot = 18 to plot all
#> vehicle_1 vehicle_2 vehicle_3 vehicle_4 #> 1 6.666667 [veh] 13.33333 [veh] 2e+01 [veh] 26.66667 [veh] #> 2 1666.666667 [veh] 1333.33333 [veh] 1e+03 [veh] 666.66667 [veh] #> 3 0.200000 [veh] 0.40000 [veh] 6e-01 [veh] 0.80000 [veh] #> vehicle_5 #> 1 33.33333 [veh] #> 2 333.33333 [veh] #> 3 1.00000 [veh]