When I have a column in a local data frame, sometimes I get the message Variables not shown
such as this (ridiculous) example just needed enough columns.
library(dplyr)
library(ggplot2) # for movies
movies %.%
group_by(year) %.%
summarise(Length = mean(length), Title = max(title),
Dramaz = sum(Drama), Actionz = sum(Action),
Action = sum(Action), Comedyz = sum(Comedy)) %.%
mutate(Year1 = year + 1)
year Length Title Dramaz Actionz Action Comedyz
1 1898 1.000000 Pack Train at Chilkoot Pass 1 0 0 2
2 1894 1.000000 Sioux Ghost Dance 0 0 0 0
3 1902 3.555556 Voyage dans la lune, Le 1 0 0 2
4 1893 1.000000 Blacksmith Scene 0 0 0 0
5 1912 24.382353 Unseen Enemy, An 22 0 0 4
6 1922 74.192308 Trapped by the Mormons 20 0 0 16
7 1895 1.000000 Photographe 0 0 0 0
8 1909 9.266667 What Drink Did 14 0 0 7
9 1900 1.437500 Uncle Josh's Nightmare 2 0 0 5
10 1919 53.461538 When the Clouds Roll by 17 2 2 29
.. ... ... ... ... ... ... ...
Variables not shown: Year1 (dbl)
I want to see Year1
! How do I see all the columns, preferably by default.
movies %.% group_by(year) %.% ....... %.% print.default
dplyr
uses, instead of the default print option,dplyr:::print.tbl_df
to make sure your screen doesn't overload with huge data-sets. When you've finally whittled your stuff down to what you want and don't want to be saved from your own mistakes anymore, just stickprint.default
on the end to spit out everything.BTW,
methods(print)
shows how many packages need to write their ownprint
functions (think about, eg,igraph
orxts
--- these are new data-types so you need to tell them how to be displayed on the screen).HTH the next googler.
You might like
glimpse
:dplyr
has its own printing functions fordplyr
objects. In this case, the object that is the result of your operation istbl_df
. The matching print function is thendplyr:::print.tbl_df
. This reveals thattrunc_mat
is the function responsible for what is printed and not, including which variables.Sadly,
dplyr:::print.tbl_df
does not pass on any parameters totrunc_mat
andtrunc_mat
also does not support choosing which variables are shown (only how many rows). A workaround is to cast the result of dplyr to adata.frame
and usehead
:There's (now) a way of overriding the width of columns that gets printed out. If you run this command all will be well
I wrote it up here.
So, this is a bit old, but I found this when looking for answers to same problem. I came up with this solution that holds to the spirit of piping but identical in function to the accepted answer (note that the pipe symbol
%.%
is deprecated in favor of%>%
)