arrange.temporal_cubble_df | R Documentation |
dplyr
methodsVerbs supported for both nested and long cubble include:
dplyr::mutate()
, dplyr::filter()
, dplyr::arrange()
, dplyr::select()
,
dplyr::group_by()
, dplyr::ungroup()
, dplyr::summarise()
,.
dplyr::rename()
, dplyr::bind_cols()
, dplyr::rowwise()
,
dplyr::slice_*()
, dplyr::*_join()
, dplyr::relocate()
,
dplyr::pull()
## S3 method for class 'temporal_cubble_df'
arrange(.data, ...)
## S3 method for class 'spatial_cubble_df'
select(.data, ...)
## S3 method for class 'temporal_cubble_df'
select(.data, ...)
## S3 method for class 'spatial_cubble_df'
group_by(.data, ..., .add, .drop)
## S3 method for class 'temporal_cubble_df'
group_by(.data, ..., .add, .drop)
## S3 method for class 'spatial_cubble_df'
ungroup(x, ...)
## S3 method for class 'temporal_cubble_df'
ungroup(x, ...)
## S3 method for class 'spatial_cubble_df'
summarise(.data, ..., .by = NULL, .groups = NULL)
## S3 method for class 'temporal_cubble_df'
summarise(.data, ..., .by = key_vars(.data), .groups = NULL)
## S3 method for class 'spatial_cubble_df'
rename(.data, ...)
## S3 method for class 'temporal_cubble_df'
rename(.data, ...)
bind_rows.temporal_cubble_df(..., .id = NULL)
bind_cols.spatial_cubble_df(..., .name_repair)
bind_cols.temporal_cubble_df(..., .name_repair)
## S3 method for class 'spatial_cubble_df'
rowwise(data, ...)
## S3 method for class 'temporal_cubble_df'
rowwise(data, ...)
## S3 method for class 'cubble_df'
dplyr_col_modify(data, cols)
## S3 method for class 'spatial_cubble_df'
dplyr_row_slice(data, i, ...)
## S3 method for class 'temporal_cubble_df'
dplyr_row_slice(data, i, ...)
## S3 method for class 'spatial_cubble_df'
dplyr_reconstruct(data, template)
## S3 method for class 'temporal_cubble_df'
dplyr_reconstruct(data, template)
## S3 method for class 'spatial_cubble_df'
mutate(.data, ...)
## S3 method for class 'temporal_cubble_df'
mutate(.data, ...)
## S3 method for class 'spatial_cubble_df'
filter(.data, ...)
## S3 method for class 'spatial_cubble_df'
arrange(.data, ...)
You may find not all the verbs have a verb.spatial_cubble_df
or
verb.temporal_cubble_df
implemented. These verbs call
the dplyr extending trios: dplyr_row_slice
, dplyr_col_modify
,
and dplyr_reconstruct
under the hood.
See https://dplyr.tidyverse.org/reference/dplyr_extending.html
library(dplyr)
cb_nested <- climate_mel
cb_long <- face_temporal(climate_mel)
# filter - currently filter.spatial_cubble_df, dply_row_slice
cb_nested |> filter(elev > 40)
cb_long |> filter(prcp > 0)
# mutate - curerntly mutate.spatial_cubble_df, dply_col_modify
cb_nested |> mutate(elev2 = elev + 10)
cb_long |> mutate(prcp2 = prcp + 10)
# arrange - currently arrange.spatial_cubble_df, arrange.temporal_cubble_df
cb_nested |> arrange(wmo_id)
cb_long |> arrange(prcp)
# summarise - summarise.spatial_cubble_df, summarise.temporal_cubble_df
cb_long |>
group_by(first_5 = ifelse(lubridate::day(date) <=5, 1, 2 )) |>
summarise(tmax = mean(tmax))
cb_long |>
mutate(first_5 = ifelse(lubridate::day(date) <=5, 1, 2)) |>
summarise(t = mean(tmax), .by = first_5)
# select - select.spatial_cubble_df, select.temporal_cubble_df
cb_nested |> select(name)
cb_nested |> select(-id, -name)
cb_long |> select(prcp)
cb_long |> select(-prcp, -date)
# rename - rename.spatial_cubble_df, rename.temporal_cubble_df
cb_nested |> rename(elev2 = elev)
cb_long |> rename(prcp2 = prcp)
# rename on key attributes
cb_nested |> rename(id2 = id)
cb_long |> rename(date2 = date)
# join - mutate_join - dplyr_reconstruct()
# join - filter_join - dplyr_row_slice()
df1 <- cb_nested |> as_tibble() |> select(id, name) |> head(2)
nested <- cb_nested |> select(-name)
nested |> left_join(df1, by = "id")
nested |> right_join(df1, by = "id")
nested |> inner_join(df1, by = "id")
nested |> full_join(df1, by = "id")
nested |> anti_join(df1, by = "id")
# bind_rows - dplyr_reconstruct, bind_rows.temporal_cubble_df
df1 <- cb_nested |> head(1)
df2 <- cb_nested |> tail(2)
bind_rows(df1, df2)
df1 <- cb_long |> head(10)
df2 <- cb_long |> tail(20)
bind_rows(df1, df2)
# relocate - dplyr_col_select, dplyr_col_select
cb_nested |> relocate(ts, .before = name)
cb_nested |> face_temporal() |> relocate(tmin)
# slice - all the slice_* uses dplyr::slice(), which uses dplyr_row_slice()
cb_nested |> slice_head(n = 2)
cb_nested |> slice_tail(n = 2)
cb_nested |> slice_max(elev)
cb_nested |> slice_min(elev)
cb_nested |> slice_sample(n = 2)
# rowwise - rowwise.spatial_cubble_df, rowwise.temporal_cuble_df
cb_nested |> rowwise()
cb_long |> rowwise()
# group_by & ungroup -
(res <- cb_nested |> mutate(group1 = c(1, 1, 2)) |> group_by(group1))
res |> ungroup()
(res2 <- res |> face_temporal())
res2 |> ungroup()
res2 |> mutate(first_5 = ifelse(lubridate::day(date) <= 5, 1, 6)) |>
group_by(first_5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.