These functions rename locations, datasets, params, and columns, making sure internal consistency is maintained. These functions use dplyr syntax for renaming (i.e. the rename function). This syntax can also be used while subsetting using select_locations and family.
rename_locations(.data, ...) # S3 method for default rename_locations(.data, ...) rename_params(.data, ...) # S3 method for default rename_params(.data, ...) rename_datasets(.data, ...) # S3 method for default rename_datasets(.data, ...) rename_columns(.data, ...) # S3 method for default rename_columns(.data, ...)
.data | A mudata object |
---|---|
... | Variables to rename in the form |
A modified mudata object
rename_datasets(kentvillegreenwood, avalley = ecclimate)#> A mudata object aligned along "date" #> distinct_datasets(): "avalley" #> distinct_locations(): "GREENWOOD A", "KENTVILLE CDA CS" #> distinct_params(): "cooldegdays", "dirofmaxgust" ... and 9 more #> src_tbls(): "data", "locations" ... and 3 more #> #> tbl_data() %>% head(): #> # A tibble: 6 x 6 #> dataset location param date value flags #> <chr> <chr> <chr> <date> <dbl> <chr> #> 1 avalley KENTVILLE CDA CS maxtemp 1999-07-01 28.5 <NA> #> 2 avalley KENTVILLE CDA CS maxtemp 1999-07-02 30.7 <NA> #> 3 avalley KENTVILLE CDA CS maxtemp 1999-07-03 26.4 <NA> #> 4 avalley KENTVILLE CDA CS maxtemp 1999-07-04 28.6 <NA> #> 5 avalley KENTVILLE CDA CS maxtemp 1999-07-05 26 <NA> #> 6 avalley KENTVILLE CDA CS maxtemp 1999-07-06 25.3 <NA>#> A mudata object aligned along "date" #> distinct_datasets(): "ecclimate" #> distinct_locations(): "Greenwood", "KENTVILLE CDA CS" #> distinct_params(): "cooldegdays", "dirofmaxgust" ... and 9 more #> src_tbls(): "data", "locations" ... and 3 more #> #> tbl_data() %>% head(): #> # A tibble: 6 x 6 #> dataset location param date value flags #> <chr> <chr> <chr> <date> <dbl> <chr> #> 1 ecclimate KENTVILLE CDA CS maxtemp 1999-07-01 28.5 <NA> #> 2 ecclimate KENTVILLE CDA CS maxtemp 1999-07-02 30.7 <NA> #> 3 ecclimate KENTVILLE CDA CS maxtemp 1999-07-03 26.4 <NA> #> 4 ecclimate KENTVILLE CDA CS maxtemp 1999-07-04 28.6 <NA> #> 5 ecclimate KENTVILLE CDA CS maxtemp 1999-07-05 26 <NA> #> 6 ecclimate KENTVILLE CDA CS maxtemp 1999-07-06 25.3 <NA>rename_params(kentvillegreenwood, max_temp = maxtemp) rename_columns(kentvillegreenwood, lon = longitude, lat = latitude)#> A mudata object aligned along "date" #> distinct_datasets(): "ecclimate" #> distinct_locations(): "GREENWOOD A", "KENTVILLE CDA CS" #> distinct_params(): "cooldegdays", "dirofmaxgust" ... and 9 more #> src_tbls(): "data", "locations" ... and 3 more #> #> tbl_data() %>% head(): #> # A tibble: 6 x 6 #> dataset location param date value flags #> <chr> <chr> <chr> <date> <dbl> <chr> #> 1 ecclimate KENTVILLE CDA CS maxtemp 1999-07-01 28.5 <NA> #> 2 ecclimate KENTVILLE CDA CS maxtemp 1999-07-02 30.7 <NA> #> 3 ecclimate KENTVILLE CDA CS maxtemp 1999-07-03 26.4 <NA> #> 4 ecclimate KENTVILLE CDA CS maxtemp 1999-07-04 28.6 <NA> #> 5 ecclimate KENTVILLE CDA CS maxtemp 1999-07-05 26 <NA> #> 6 ecclimate KENTVILLE CDA CS maxtemp 1999-07-06 25.3 <NA>