library(dplyr)

create a simple tbl_df

v1 = c(1,2,3)
v2 = c("a", "b", "c")
tdf = tbl_df(data.frame("val" = v1, "name" = v2))

Using save() & load()

Using save() in this way also saves the name of the data structure. So wehn you load it, the name of the original data frame is used.

Note that we are able to save and load a tbl_df without having to convert to data.frame

save(tdf, file="~/Desktop/tdf.Rda")

# Delete the tbl_df
tdf = NULL

# Re-instantiate it via load
load("~/Desktop/tdf.Rda")

# tdf is reloaded
glimpse(tdf)
## Observations: 3
## Variables:
## $ val  (dbl) 1, 2, 3
## $ name (fctr) a, b, c