I try to follow the tidyverse
approach and I extracted numerical data as tibble. As a matrix I would just transpose the data. There seems to be the function tribble
in tibble
for this but I can not make it work.
How can I set the column names in the call? I can't see it from the help.
library(tidyverse)
iris = as_data_frame(iris)
iris = select(iris,-Species)
tribble(iris)
gives the error
Error: no column names detected in 'tribble()' call
PS: I think there should be an easier way than doing this.
?tribble
, I don't think this function has anything to do with transposingtibble
objects (or any other type of existing object). – nrusselltransposed_tibble_object <- tribble(tibble_object)
I'm pretty sure there would be at least one example of that in the help file. As for your question, callingt(tibble_object)
will dispatcht.data.frame
. Does that not produce the output you are looking for? – nrussellt.tbl_df <- function(x) { as_data_frame(t.data.frame(x)) }
as a work around. – nrussell