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))

save() & load()

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

# Delete the tbl_df
rm(tdf)

# Re-instantiate it via load, tdf is reloaded into the environment
load("~/Documents/temp/tdf.Rda")

# another variable to save
x = 10

save(tdf, x, file="~/Documents/temp/tdf.Rda")

# remove the variables from the environment
rm(tdf)
rm(x)

exists("tdf")  # FALSE
exists("x")    # FALSE

load("~/Documents/temp/tdf.Rda")

exists("tdf")  # TRUE
exists("x")    # TRUE

saveRDS() & readRDS()

saveRDS(tdf, file="~/Documents/temp/tdf.Rda")

rm(tdf)

# need to assign result to a variable
tdf = readRDS("~/Documents/temp/tdf.Rda")

exists("tdf")   # TRUE

write.table()

write.table(tdf, "~/Documents/temp/tabbed.txt", sep="\t", row.names = FALSE)