hased
hased

Reputation: 63

R : warning : The `x` argument of `as_tibble.matrix()` must have unique column names if `.name_repair` is omitted as of tibble 2.0.0

umap_results$layout
  #         [,1]         [,2]
  #[1,] -1.041482307  1.389173771
  #[2,]  0.686965089  2.671049064
  #[3,] -2.170222731 -0.347427768
  #[4,] -2.028087128  2.476267251
  #[5,] -1.070957496 -0.354622580
  #[6,] -1.174079325 -1.174164172
  #[7,] -2.777973062  2.372981619
  #[8,] -1.237910856  0.798519857
  #[9,] -1.551065808  1.186282879
  #[10,] -2.686569147  2.606249490

umap_results_tbl <- umap_results$layout %>%
  as_tibble()%>%
  mutate(symbol = stock_date_matrix_tbl$symbol)

#symbol is just a simple column with alphabets e.g. symbol = #c(A,AL,AP)

I do not understand why the error tells me to input unique column while I did give a unique column(layout). Can you please explain why?

Upvotes: 2

Views: 2709

Answers (1)

akrun
akrun

Reputation: 887153

It is just a warning. The warning is issued the object input is a matrix and it doesn't have any column names.

library(tibble)
cbind(1:5, 6:10) %>% 
        as_tibble()

There is an option to override the warning if we use the .name_repair and by default it uses the option check_unique

cbind(1:5, 6:10) %>%
     as_tibble(.name_repair = 'unique')

Upvotes: 5

Related Questions