Question
I recall, but cannot seem to find, a built-in function that allows you to generate the code for creating a tibble / dataframe from an existing tibble / dataframe.
In other words, suppose I have the standard iris dataframe. I would like to generate the code to build this dataframe manually. The function I am looking for would produce something like the following:
# Function Call
Theoretical_Function_I_Recall_Exists_But_Cant_Find(iris)
# Output of Function
tibble::tribble(
~Sepal.Length, ~Sepal.Width, ~Petal.Length, ~Petal.Width, ~Species,
5.1, 3.5, 1.4, 0.2, "setosa",
4.9, 3.0, 1.4, 0.2, "setosa",
4.7, 3.2, 1.3, 0.2, "setosa",
4.6, 3.1, 1.5, 0.2, "setosa",
5.0, 3.6, 1.4, 0.2, "setosa"
)
I could swear that a function to do this already exists, but multiple forays into the help docs and Google have come up empty ...
Anyone recall if such a function actually exists?
dput works well here - also part of base R too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With