dplyr-surveydata: Methods to support dplyr verbs.

Description Usage Arguments Details Examples

Description

Methods to support dplyr verbs.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## S3 method for class 'surveydata'
mutate(.data, ...)

## S3 method for class 'surveydata'
as.tbl(.data, ...)

## S3 method for class 'surveydata'
select(.data, ...)

## S3 method for class 'surveydata'
filter(.data, ...)

## S3 method for class 'surveydata'
arrange(.data, ...)

## S3 method for class 'surveydata'
summarize(.data, ...)

## S3 method for class 'surveydata'
slice(.data, ...)

Arguments

.data

surveydata object or tbl passed to dplyr verb

...

passed to dplyr verb

Details

The surveydata exposes functionality to support some of the dplyr verbs, e.g. dplyr::filter()

Examples

1
2
library(dplyr)
membersurvey %>% as.tbl() %>% filter(Q2 == 2009)

Example output

Attaching package: 'surveydata'

The following object is masked from 'package:stats':

    filter


Attaching package: 'dplyr'

The following objects are masked from 'package:stats':

    filter, lag

The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union

# A tibble: 20 x 109
      id  Q1_1  Q1_2    Q2   Q3_1   Q3_2   Q3_3   Q3_4   Q3_5   Q3_6   Q3_7
   <dbl> <dbl> <dbl> <ord> <fctr> <fctr> <fctr> <fctr> <fctr> <fctr> <fctr>
 1     3     8   2.0  2009     No     No     No     No     No     No     No
 2    21    12   2.5  2009    Yes     No     No     No     No    Yes    Yes
 3    31    20   5.0  2009    Yes    Yes     No    Yes    Yes     No     No
 4    66    25   2.0  2009    Yes     No     No     No     No     No     No
 5    89     7   2.5  2009     No     No     No     No    Yes     No     No
 6   116     7  20.0  2009    Yes     No     No     No     No     No     No
 7   142    12   3.0  2009    Yes     No     No     No     No     No     No
 8   146    NA  26.0  2009     No     No     No     No     No     No     No
 9   194     5   2.0  2009     No    Yes     No     No     No     No     No
10   195    20  10.0  2009    Yes    Yes     No     No     No     No     No
11   197    25  14.0  2009    Yes    Yes     No    Yes    Yes    Yes     No
12   214    25   2.0  2009     No     No    Yes    Yes    Yes    Yes     No
13   219    27   2.0  2009    Yes    Yes    Yes    Yes    Yes    Yes    Yes
14   221    20   1.0  2009     No     No    Yes    Yes    Yes    Yes    Yes
15   222    19   7.0  2009    Yes     No     No     No     No     No     No
16   239    11   4.0  2009    Yes     No     No    Yes    Yes    Yes    Yes
17   253    12   7.0  2009    Yes     No     No    Yes    Yes     No    Yes
18   255    31  11.0  2009    Yes     No     No     No     No     No     No
19   269    45  25.0  2009    Yes    Yes     No    Yes    Yes    Yes     No
20   276     5  10.0  2009    Yes     No     No    Yes     No    Yes    Yes
# ... with 98 more variables: Q3_8 <fctr>, Q3_9 <fctr>, Q3_10 <fctr>,
#   Q3_11 <fctr>, Q3_12 <fctr>, Q3_13 <fctr>, Q3_14 <fctr>, Q3_15 <fctr>,
#   Q4 <fctr>, Q5 <fctr>, Q6_1 <fctr>, Q6_2 <fctr>, Q6_3 <fctr>, Q6_4 <fctr>,
#   Q6_5 <fctr>, Q6_6 <fctr>, Q6_7 <fctr>, Q6_8 <fctr>, Q6_9 <fctr>,
#   Q6_10 <fctr>, Q7 <fctr>, Q8 <fctr>, Q9_1 <fctr>, Q9_2 <fctr>, Q9_3 <fctr>,
#   Q9_4 <fctr>, Q9_5 <fctr>, Q10 <fctr>, Q11_1 <fctr>, Q11_2 <fctr>,
#   Q11_3 <fctr>, Q11_4 <fctr>, Q11_5 <fctr>, Q11_other <fctr>, Q12_1 <fctr>,
#   Q13_1 <fctr>, Q13_2 <fctr>, Q13_3 <fctr>, Q13_4 <fctr>, Q14_1 <fctr>,
#   Q14_2 <fctr>, Q14_3 <fctr>, Q14_4 <fctr>, Q14_5 <fctr>, Q14_6 <fctr>,
#   Q14_7 <fctr>, Q14_8 <fctr>, Q14_9 <fctr>, Q14_10 <fctr>, Q15_1 <fctr>,
#   Q15_2 <fctr>, Q15_3 <fctr>, Q15_4 <fctr>, Q15_5 <fctr>, Q15_6 <fctr>,
#   Q19_1 <fctr>, Q19_2 <fctr>, Q19_3 <fctr>, Q19_4 <fctr>, Q19_5 <fctr>,
#   Q19_6 <fctr>, Q20_1 <fctr>, Q20_2 <fctr>, Q20_3 <fctr>, Q20_4 <fctr>,
#   Q20_5 <fctr>, Q20_6 <fctr>, Q20_7 <fctr>, Q20_8 <fctr>, Q20_9 <fctr>,
#   Q20_10 <fctr>, Q20_other <fctr>, Q21_1 <fctr>, Q21_2 <fctr>, Q21_3 <fctr>,
#   Q21_4 <fctr>, Q21_5 <fctr>, Q21_6 <fctr>, Q23_1 <fctr>, Q23_2 <fctr>,
#   Q23_3 <fctr>, Q23_4 <fctr>, Q23_5 <fctr>, Q23_other <fctr>, Q24 <dbl>,
#   Q25 <dbl>, Q26_1 <ord>, Q27_1 <dbl>, Q27_2 <dbl>, Q30 <fctr>,
#   Q30_other <fctr>, Q31 <fctr>, Q31_other <fctr>, Q32 <ord>, Q33 <fctr>,
#   Q35 <fctr>, weight <dbl>, size <dbl>

surveydata documentation built on Dec. 7, 2018, 1:04 a.m.