首页 文章

生成Tibble / DataFrame代码

提问于
浏览
0

Question

我记得,但似乎无法找到,内置函数允许您生成用于从现有的tibble / dataframe创建tibble / dataframe的代码 .

换句话说,假设我有标准的 iris 数据帧 . 我想生成代码来手动构建这个数据帧 . 我正在寻找的功能将产生如下内容:

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

我可以发誓这样做的功能已经存在,但多次涉足帮助文档和谷歌已经出现空洞......

有人记得这样的功能是否确实存在?

1 回答

  • 0

    dput 在这里运作良好 - 也是基地R的一部分 .

相关问题