Hi,
is there any nicer way how to bind dataframes that this manual?
TA <- d_2022 |>
bind_cols(d_2021) |>
bind_cols(d_2020) |>
bind_cols(d_2019) |>
bind_cols(d_2018) |>
bind_cols(d_2017) |>
bind_cols(d_2016)
Many thanks,
Jakub
Hi,
is there any nicer way how to bind dataframes that this manual?
TA <- d_2022 |>
bind_cols(d_2021) |>
bind_cols(d_2020) |>
bind_cols(d_2019) |>
bind_cols(d_2018) |>
bind_cols(d_2017) |>
bind_cols(d_2016)
Many thanks,
Jakub
I am sure there are better ways but
TA <- cbind(d_2022,
d_2021,
d_2020,
d_2019,
d_2018,
d_2017,
d_2016)
bind_col already supports multiple entries
i.e.
bind_cols(d_2022,d_2021,d_2020 etc...
are your names 2016 to 2022 inferable from the logic of your program and its data ?
i.e.
bind_cols(mget(paste0("d_",2020:2022)))
you could potentially have variables that replace 2020 / 2022 in this example
Forgot that one could use paste0 here!
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.