This is a minor issue but in R when you type head(data.frame)
you get the first few records from all the columns displayed. In the dplyr
package the head function has been altered to only show the columns that can fit in your console window. This is often nice, but often I want to see the first few records for all the columns. Is there a way to tell head (in dplyr
) to show all columns without converting the tbl.df
/data.frame
to a data.frame
(and I prefer head
to str()
).
Thanks!
ZR
The head() function in R is used to display the first n rows present in the input data frame.
The dplyr package in R Programming Language is a structure of data manipulation that provides a uniform set of verbs, helping to resolve the most frequent data manipulation hurdles.
head () function is used to access the first n rows of a dataframe or series. It returns a smaller version of the caller object with the first few entries. In this article, you will learn how to use the python head function , customizing the number of entries and two more functions that do the same job differently.
you can now use the glimpse()
verb in dplyr 0.2 :
from https://github.com/hadley/dplyr/releases :
"
glimpse()
makes it possible to see all the columns in a tbl, displaying as much data for each variable as can be fit on a single line."
As Arun said, it's because of the print.tbl_df method. Just do:
print.data.frame(head(your_dplyr_dataframe))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With