Zoo time series do not have an attribute 'name'. However, within distantia
, to keep data consistency in several plotting and analysis operations, an attribute 'name' is used for these objects. This function is a convenient wrapper of attr(x = x, which = "name") <- "xxx"
.
See also
Other zoo_functions:
zoo_aggregate()
,
zoo_name_clean()
,
zoo_name_get()
,
zoo_permute()
,
zoo_plot()
,
zoo_resample()
,
zoo_time()
,
zoo_to_tsl()
,
zoo_vector_to_matrix()
Examples
#simulate zoo time series
x <- zoo_simulate()
#get current name
zoo_name_get(x = x)
#> [1] "A"
#change name
x <- zoo_name_set(
x = x,
name = "My.New.name"
)
#> distantia::zoo_name_set(): renaming zoo time series from 'A' to 'My.New.name'.
zoo_name_get(x = x)
#> [1] "My.New.name"
#clean name
x <- zoo_name_clean(
x = x,
lowercase = TRUE
)
#> distantia::zoo_name_set(): renaming zoo time series from 'My.New.name' to 'my_new_name'.
zoo_name_get(x = x)
#> [1] "my_new_name"