I remember reading somewhere that as.tibble()
is an alias for as_data_frame()
, but I don't know what exactly an alias is in programming terminology. Is it similar to a wrapper?
So I guess my question probably comes down to the difference in possible usages between tbl_df()
and as_data_frame()
: what are the differences between them, if any?
More specifically, given a (non-tibble) data frame df
, I often turn it into a tibble by using:
df <- tbl_df(df)
Wouldn't
df <- as_data_frame(df)
do the same thing? If so, are there other cases where the two functions tbl_df()
and as_data_frame()
can not be used interchangeably to get the same result?
The R documentation says that
tbl_df()
forwards the argument toas_data_frame()
does that mean that tbl_df()
is a wrapper or alias for as_data_frame()
? R documentation doesn't seem to say anything about as.tibble()
and I forgot where I read that it was an alias for as_data_frame()
. Also, apparently as_tibble()
is another alias for as_data_frame()
.
If these four functions really are all the same function, what is the sense in giving one function four different names? Isn't that more confusing than helpful?