Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/check-standard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@ jobs:
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-pandoc@v1
- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v1
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
testthat,
httptest,
rcmdcheck

- uses: r-lib/actions/check-r-package@v1
- uses: r-lib/actions/check-r-package@v2
4 changes: 2 additions & 2 deletions .github/workflows/devtools-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint-project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ jobs:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-pandoc@v1
- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v1
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: pkgdown
needs: website
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ Suggests:
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.1.2
RoxygenNote: 7.2.1
URL: https://github.com/mattroumaya/surveymonkey
BugReports: https://github.com/mattroumaya/surveymonkey/issues
10 changes: 8 additions & 2 deletions R/assemble.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@
#' @param fix_duplicates character if 'error', the default detection of duplicate data will result
#' in an error being raised, otherwise allow the function to return. If 'keep' duplicate results
#' will be retained, if 'drop' duplicates will be removed from the results.
#'
#' If encountering issues with duplicates, use `fix_duplicates = 'none'` to deal with duplicate responses after
#' the survey is parsed.
#' @return a data.frame (technically a \code{tibble}) with clean responses, one line per respondent.
#' @importFrom rlang .data
#' @export
parse_survey <- function(
surv_obj, oauth_token = get_token(), ...,
fix_duplicates = c("error", "drop", "keep")
fix_duplicates = c("error", "drop", "keep", "none")
) {
. <- NULL
if (surv_obj$response_count == 0) {
Expand Down Expand Up @@ -45,12 +48,15 @@ parse_survey <- function(
# to deal with this add parameter fix_duplicate where default behaviour is to error, but
# can be set to allow the function to continue and return.
fix_duplicates <- match.arg(fix_duplicates)

if (fix_duplicates == "error") {
x <- duplicate_error(x)
} else if (fix_duplicates == "keep") {
x <- duplicate_keep(x)
} else {
} else if (fix_duplicates == "drop") {
x <- duplicate_drop(x)
} else {
x
}


Expand Down
7 changes: 5 additions & 2 deletions man/parse_survey.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions tests/testthat/test_strip_html.r
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ test_that("all <> and values between are removed", {
expect_equal(
mtcars %>%
dplyr::select(
"What is your <strong>favorite</strong> color?" = .data$mpg,
"Keep <this> value" = .data$cyl
"What is your <strong>favorite</strong> color?" = "mpg",
"Keep <this> value" = "cyl"
) %>%
strip_html() %>%
colnames(.),
Expand All @@ -22,8 +22,8 @@ test_that("ignore values are kept", {
expect_equal(
mtcars %>%
dplyr::select(
"What is your <strong>favorite</strong> color?" = .data$mpg,
"Keep <this> value" = .data$cyl
"What is your <strong>favorite</strong> color?" = "mpg",
"Keep <this> value" = "cyl"
) %>%
strip_html(ignore = "this") %>%
colnames(.),
Expand All @@ -34,8 +34,8 @@ test_that("ignore values are kept", {
test_that("warning when values are not found", {
expect_warning(mtcars %>%
dplyr::select(
"What is your <strong>favorite</strong> color?" = .data$mpg,
"Keep <this> value" = .data$cyl
"What is your <strong>favorite</strong> color?" = "mpg",
"Keep <this> value" = "cyl"
) %>%
strip_html(ignore = "not_in_these_columns_satan!") %>%
colnames(.),
Expand All @@ -51,8 +51,8 @@ test_that("trim_space == TRUE is working correctly", {
expect_equal(
mtcars %>%
dplyr::select(
"What is your <strong>favorite</strong> color?" = .data$mpg,
"Keep <this> value" = .data$cyl
"What is your <strong>favorite</strong> color?" = "mpg",
"Keep <this> value" = "cyl"
) %>%
strip_html(trim_space = TRUE) %>%
colnames(.),
Expand All @@ -66,8 +66,8 @@ test_that("trim_space == FALSE is working correctly", {
expect_equal(
mtcars %>%
dplyr::select(
"What is your <strong>favorite</strong> color?" = .data$mpg,
"Keep <this> value" = .data$cyl
"What is your <strong>favorite</strong> color?" = "mpg",
"Keep <this> value" = "cyl"
) %>%
strip_html(trim_space = FALSE) %>%
colnames(.),
Expand Down