Code Monkey home page Code Monkey logo

Comments (8)

krlmlr avatar krlmlr commented on June 12, 2024

I'd rather not add special handling here. You can always do data_frame(x = 1:4) %>% trunc_mat or override knit_print.data_frame if space matters. I feel that consistent output can help reducing cognitive load.

from tibble.

krlmlr avatar krlmlr commented on June 12, 2024

...but perhaps we can support this with an optional argument save_space = FALSE?

from tibble.

hadley avatar hadley commented on June 12, 2024

This is important for me. I don't think it's necessary to print a summary of an object when you can see the whole thing.

from tibble.

krlmlr avatar krlmlr commented on June 12, 2024

What about the information "Source: local data frame"? I don't see how it becomes less relevant just because the result is small.

May I suggest an alternative printing mode that omits the "Source: ..." information altogether, and adds the remaining number of rows only in case of vertical overflow:

> iris %>% tibble::tbl_df %>% print(n = 6, save_space = TRUE)
   Sepal.Length Sepal.Width Petal.Length Petal.Width Species
          (dbl)       (dbl)        (dbl)       (dbl)  (fctr)
1           5.1         3.5          1.4         0.2  setosa
2           4.9         3.0          1.4         0.2  setosa
3           4.7         3.2          1.3         0.2  setosa
4           4.6         3.1          1.5         0.2  setosa
5           5.0         3.6          1.4         0.2  setosa
6           5.4         3.9          1.7         0.4  setosa
   ... (144 more rows)

> iris %>% tibble::tbl_df %>% head %>% print(n = 6, save_space = TRUE)
   Sepal.Length Sepal.Width Petal.Length Petal.Width Species
          (dbl)       (dbl)        (dbl)       (dbl)  (fctr)
1           5.1         3.5          1.4         0.2  setosa
2           4.9         3.0          1.4         0.2  setosa
3           4.7         3.2          1.3         0.2  setosa
4           4.6         3.1          1.5         0.2  setosa
5           5.0         3.6          1.4         0.2  setosa
6           5.4         3.9          1.7         0.4  setosa

This would be both concise and consistent.

from tibble.

hadley avatar hadley commented on June 12, 2024

I don't like it as an extra parameter because I don't think anyone will use it. Maybe if it was also a global option.

from tibble.

krlmlr avatar krlmlr commented on June 12, 2024

I like the option idea, we might add different printing styles later.

from tibble.

krlmlr avatar krlmlr commented on June 12, 2024

New option tibble.show.source.

from tibble.

github-actions avatar github-actions commented on June 12, 2024

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.

from tibble.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.