Tibble and all columns

Hi All,
Here below is a code:

student_id <- seq(1,10)
math <- c(502,600,412,358,495,512,410,625,573,522)
science <- c(95,99,80,82,75,85,80,95,89,86)
english <- c(25,22,18,15,20,28,15,30,27,18)

df <- data.frame(student_id,math,science,english)

df$z <- scale(df[,2:4],center=TRUE,scale=TRUE)


df2 <-  df %>% dplyr::arrange(desc(z)) %>% as_tibble()

I would like to have "full" tibble or dataframe like a console output:

but with RStudio's environment pane I have got a "short" version of it:

obraz

How is that possible ?

df and df2 both have 5 variables, just like df before it was scale()d. What appears are attributes of column z:

z         : num [1:10, 1:3] 0.0127 1.1434 -1.0257 -1.6487 -0.0681 ...
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : NULL
  .. ..$ : chr [1:3] "math" "science" "english"
  ..- attr(*, "scaled:center")= Named num [1:3] 500.9 86.6 21.8
  .. ..- attr(*, "names")= chr [1:3] "math" "science" "english"
  ..- attr(*, "scaled:scale")= Named num [1:3] 86.67 7.79 5.45
  .. ..- attr(*, "names")= chr [1:3] "math" "science" "english"

This is because scale returns a centered, scaled matrix.

Thank you Technocrat,
I tried with this:

library(data.table)
df2 <-  df %>% dplyr::arrange(desc(z)) %>% as_tibble(.name_repair = c("unique")) %>% as.data.table()

obraz

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.