Description Usage Arguments Details Value See Also Examples
Convenience function to view all the columns of the head
of a truncated data.frame
. peek
invisibly returns
x
. This makes its use ideal in a dplyr/magrittr pipeline.
1 |
x |
A |
n |
Number of rows to display. |
width |
The width of the columns to be displayed. |
... |
For internal use. |
By default dplyr does not print all columns of a data frame
(tbl_df
). This makes inspection of data difficult at times,
particularly with text string data. peek
allows the user to see a
truncated head for inspection purposes.
Prints a truncated head but invisibly returns x
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | (dat1 <- r_data_frame(100, id, sentence, paragraph))
peek(dat1)
peek(dat1, n = 20)
peek(dat1, width = 40)
library(dplyr)
## Use in a dplyr/magrittr pipeline to view the data (silly example)
par(mfrow = c(2, 2))
r_data_frame(1000, id, sex, pet, employment, eye, sentence, paragraph) %>%
peek %>%
(function(x, ind = 2:5){ invisible(lapply(ind, function(i) pie(table(x[[i]]))))})
## A wider data set example
dat2 <- r_data_theme()
dat2
peek(dat2)
|
# A tibble: 100 x 3
ID
<chr>
1 001
2 002
3 003
4 004
5 005
6 006
7 007
8 008
9 009
10 010
# ... with 90 more rows, and 2 more variables: Sentence <chr>, Paragraph <chr>
Source: local data frame [100 x 3]
ID Sentence Paragraph
1 001 The reason Lorem ipsu
2 002 When I cam Magna frin
3 003 Mister Pre Ante lacus
4 004 But going Lacinia an
5 005 President Non lobort
6 006 Well, let Commodo vu
7 007 Number one Eu faucibu
8 008 And do you Lectus dui
9 009 Governor R Pulvinar e
10 010 And I don' Quisque et
.. ... ... ...
Source: local data frame [100 x 3]
ID Sentence Paragraph
1 001 The reason Lorem ipsu
2 002 When I cam Magna frin
3 003 Mister Pre Ante lacus
4 004 But going Lacinia an
5 005 President Non lobort
6 006 Well, let Commodo vu
7 007 Number one Eu faucibu
8 008 And do you Lectus dui
9 009 Governor R Pulvinar e
10 010 And I don' Quisque et
11 011 I did not Sodales al
12 012 And one of Eu urna eg
13 013 The look, Adipiscing
14 014 I'll get i Dictumst e
15 015 Since both Netus non
16 016 And what I Euismod se
17 017 They have Erat phase
18 018 Attacking Hac a cong
19 019 Here's wha Sollicitud
20 020 Is it with Litora mag
.. ... ... ...
Source: local data frame [100 x 3]
ID Sentence Paragraph
1 001 The reason is, is because, when we refor Lorem ipsum dolor sit amet, metus sed ni
2 002 When I came into office, we were still b Magna fringilla vestibulum vitae sed dic
3 003 Mister President? Ante lacus, nunc in aliquam massa, curae
4 004 But going back to Libya because this is Lacinia ante ac lectus donec nunc tempor
5 005 President Bush didn't. Non lobortis vitae sem, cum. Quam, dapib
6 006 Well, let me first of all talk about our Commodo vulputate sed cursus montes done
7 007 Number one, I want to build manufacturin Eu faucibus, eget sollicitudin amet arcu
8 008 And do you yeah. Lectus duis ac consequat interdum primis
9 009 Governor Romney, pay equity for women? Pulvinar egestas ex mollis eget et, matt
10 010 And I don't mean you, Mister President, Quisque et et nascetur in vel amet sit.
.. ... ... ...
Attaching package: 'dplyr'
The following object is masked from 'package:wakefield':
id
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
Source: local data frame [1000 x 7]
ID Sex Pet Employment Eye Sentence Paragraph
1 0001 Female Dog Retired Brown I believe Lorem ipsu
2 0002 Male None Full Time Brown Lorraine? Diam nunc
3 0003 Male Horse Full Time Blue The head o Vel enim t
4 0004 Female Cat Retired Blue First, lif In, ligula
5 0005 Male Cat Full Time Brown Governor, Phasellus
6 0006 Female Bird Retired Brown Now one of Enim eget
7 0007 Male Cat Part Time Brown And we are Dui litora
8 0008 Female Dog Full Time Blue Instead, i Netus cras
9 0009 Male None Full Time Brown I served a Ultrices j
10 0010 Male Cat Full Time Hazel But it's i Quam ac ve
.. ... ... ... ... ... ... ...
# A tibble: 100 x 49
Age Animal Answer Area Car Children
<int> <fctr> <fctr> <fctr> <fctr> <int>
1 32 Little Penguin Yes Rural Camaro Z28 3
2 29 Anatolian Shepherd Dog No Suburban Lotus Europa 0
3 26 African Palm Civet No Urban Merc 280C 1
4 23 African Palm Civet No Rural Volvo 142E 2
5 24 Nurse Shark Yes Rural Ferrari Dino 5
6 21 Anatolian Shepherd Dog Yes Rural Merc 450SLC 4
7 26 Little Penguin Yes Urban Ford Pantera L 0
8 32 Staffordshire Bull Terrier Yes Urban Mazda RX4 0
9 30 Little Penguin Yes Rural Lotus Europa 5
10 32 Nurse Shark No Rural Maserati Bora 10
# ... with 90 more rows, and 43 more variables: Coin <fctr>, Color <fctr>,
# Date <date>, Death <lgl>, Dice <int>, DNA <fctr>, DOB <date>, Dummy <dbl>,
# Education <fctr>, Employment <fctr>, Eye <fctr>, Grade <dbl>,
# Grade_Level <fctr>, Group <fctr>, hair <fctr>, Height <dbl>, Income <dbl>,
# Browser <fctr>, IQ <dbl>, Language <fctr>, Level <int>, Likert <ord>,
# Lorem_Ipsum <chr>, Marital <fctr>, Military <fctr>, Month <fctr>,
# Name <chr>, Normal <dbl>, Political <fctr>, Race <fctr>, Religion <fctr>,
# SAT <dbl>, Sentence <chr>, Sex_1 <fctr>, Sex_2 <fctr>, Smokes <lgl>,
# Speed <dbl>, State <fctr>, String <chr>, Upper <chr>, Valid <lgl>,
# Year <int>, Zip <chr>
Source: local data frame [100 x 49]
Age Animal Answer Area Car Children Coin Color Date Death Dice DNA DOB Dummy Education Employment Eye Grade Grade_Leve Group hair Height Income Browser IQ Language Level Likert Lorem_Ipsu Marital Military Month Name Normal Political Race Religion SAT Sentence Sex_1 Sex_2 Smokes Speed State String Upper Valid Year Zip
1 32 Little Pen Yes Rural Camaro Z28 3 Heads Peachpuff 2017-10-06 FALSE 5 Adenine 2005-03-27 1 9th Grade Retired Green 81.6 8 Treatment Red 70 22845.04 IE 90 Konkani 3 Disagree Lorem ipsu Separated Marine Cor June Merle -1.4112721 Republican White Muslim 1492 Governor R Male Intersex FALSE 59 Ohio N7Fjw52nNn C FALSE 2004 66580
2 29 Anatolian No Suburban Lotus Euro 0 Tails Gray6 2017-10-06 FALSE 3 Guanine 2004-02-01 0 Associate' Part Time Blue 86.7 3 Control Black 72 48485.65 Safari 83 Pashto 3 Neutral Vel nulla Divorced Army May Chong 0.35636999 Democrat White Christian 1431 They're ju Male Female FALSE 59 Massachuse my7snqD8wO E TRUE 2006 79032
3 26 African Pa No Urban Merc 280C 1 Tails Hotpink4 2017-10-06 TRUE 1 Guanine 2004-11-05 0 No Schooli Full Time Green 80.5 7 Control Blonde 73 61047.72 Chrome 82 Kinyarwand 2 Strongly A Adipiscing Widowed Navy July George 0.31083852 Democrat White Christian 1620 Where are Female Female TRUE 55 Georgia b6rPtm0Ty7 D TRUE 2015 68387
4 23 African Pa No Rural Volvo 142E 2 Tails Peachpuff 2017-10-06 TRUE 5 Adenine 2004-08-02 0 Nursery Sc Full Time Brown 79.1 9 Control Brown 63 47376.78 Chrome 105 Bengali 4 Neutral Lacus per Divorced Navy November Jesus -0.1427016 Republican White Hindu 1461 Oh, well, Female Female TRUE 51 Utah Kjc17wLoOk C TRUE 2015 79032
5 24 Nurse Shar Yes Rural Ferrari Di 5 Heads Gray6 2017-10-06 TRUE 2 Cytosine 2004-06-12 0 Some Colle Unemployed Blue 87.5 4 Treatment Brown 68 29925.52 IE 97 Bengali 3 Neutral Phasellus Separated Navy September Peter -1.4761608 Democrat White Christian 1470 In fact, h Female Male FALSE 52 California zei2mIJjBz A FALSE 2013 71165
6 21 Anatolian Yes Rural Merc 450SL 4 Tails Grey26 2017-10-06 TRUE 3 Thymine 2003-11-12 0 Bachelor's Unemployed Blue 84.8 9 Treatment Red 73 13148.28 Chrome 108 Maithili 3 Strongly A Amet mauri Divorced Marine Cor November Sammie -0.0089083 Democrat Hispanic Hindu 1563 Those are Male Male FALSE 62 Colorado tZWfbtXfD6 D TRUE 2000 66580
7 26 Little Pen Yes Urban Ford Pante 0 Tails Gray39 2017-10-06 TRUE 5 Guanine 2004-03-12 1 Some Colle Full Time Brown 84.6 10 Treatment Black 76 39605.67 Safari 98 Persian 4 Strongly D Quis nostr Divorced Marine Cor October Yong -1.1479564 Democrat White Hindu 1614 Nothing co Male Male FALSE 51 Minnesota 3I2zeDOCy8 D TRUE 1999 71165
8 32 Staffordsh Yes Urban Mazda RX4 0 Tails Thistle 2017-10-06 FALSE 2 Adenine 2005-02-03 0 Regular Hi Full Time Blue 88 8 Treatment Blonde 70 6565.41 Chrome 104 Akan 4 Strongly A Taciti sit Divorced Army June Jean -0.5514795 Democrat Hispanic None 1570 And I will Male Intersex FALSE 58 Virginia T6icwaNtVL B TRUE 2000 63589
9 30 Little Pen Yes Rural Lotus Euro 5 Tails Peachpuff 2017-10-06 TRUE 2 Adenine 2005-03-22 1 9th Grade Unemployed Blue 90.4 4 Control Black 68 12229.04 IE 106 Spanish 2 Strongly D Tellus, le Married Navy April Andre 1.45192817 Republican White Muslim 1386 Bringing d Female Male TRUE 59 Washington txKaJIeIx9 D FALSE 2000 15400
10 32 Nurse Shar No Rural Maserati B 10 Heads Gray6 2017-10-06 FALSE 3 Cytosine 2003-09-17 1 Regular Hi Full Time Blue 86.8 11 Control Brown 66 21176.4 Chrome 99 Telugu 4 Agree Aliquam fe Widowed Army May Micah -0.6472541 Democrat White Buddhist 1618 That's the Female Female FALSE 60 California 9j47VQTiGD A FALSE 2010 63589
.. ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.