csgillespie / rtypeform

@@ -1,4 +1,3 @@
Loading
1 -
globalVariables("obj_name")
2 1
#' @importFrom lubridate tz with_tz is.POSIXct ymd_hms
3 2
format_date_time = function(date_time) {
4 3
  if (is.null(date_time)) return(NULL)
@@ -15,7 +14,7 @@
Loading
15 14
16 15
create_argument = function(arg) {
17 16
  if (is.null(arg) || nchar(arg) == 0) return("")
18 -
  obj_name = deparse(substitute(arg))
17 +
  obj_name = deparse(substitute(arg)) # nolint
19 18
  glue("{obj_name}={arg}")
20 19
}
21 20

@@ -1,4 +1,3 @@
Loading
1 -
globalVariables(c("forms", "name1"))
2 1
3 2
#' @rdname get_workspaces
4 3
#' @export
@@ -15,6 +14,7 @@
Loading
15 14
#' @export
16 15
#' @inheritParams get_api
17 16
#' @inheritParams get_forms
17 +
#' @importFrom rlang .data
18 18
get_workspaces = function(api = NULL,
19 19
                          search = NULL,
20 20
                          page = 1,
@@ -27,7 +27,7 @@
Loading
27 27
  content = get_response(api = api, url)
28 28
  items = content$items
29 29
  workspaces = items %>%
30 -
    select(-forms, -self) %>%
30 +
    select(-.data$forms, -.data$self) %>%
31 31
    as_tibble() %>%
32 32
    bind_cols(items$forms, items$self)
33 33
  attr(workspaces, "page_count") = content$page_space
@@ -36,6 +36,7 @@
Loading
36 36
}
37 37
38 38
#' @importFrom httr content_type_json
39 +
#' @importFrom rlang .data
39 40
#' @param workspace_name The name workspace name
40 41
#' @rdname get_workspaces
41 42
#' @export
@@ -46,7 +47,7 @@
Loading
46 47
  content = post_response(api = api, url, body = body, content_type_json())
47 48
  content %>%
48 49
    flatten_dfc() %>%
49 -
    rename(workspace_name = name1)
50 +
    rename(workspace_name = .data$name1)
50 51
}
51 52
52 53
#' @rdname get_workspaces

@@ -13,7 +13,6 @@
Loading
13 13
  content$total_items
14 14
}
15 15
16 -
globalVariables(c("settings", "self", "theme", "href", "href1", "display", "last_updated_at"))
17 16
#' Fetch all available typeforms
18 17
#'
19 18
#' This function returns a two column data frame containing the typeform names and
@@ -28,6 +27,7 @@
Loading
28 27
#' @return A list containing content and the response.
29 28
#' @import dplyr purrr
30 29
#' @importFrom tidyr unnest
30 +
#' @importFrom rlang .data
31 31
#' @export
32 32
get_forms = function(api = NULL,
33 33
                     page = 1,
@@ -53,18 +53,20 @@
Loading
53 53
                    is_trial = "", questions = "", theme = "", questionnaire_url = "")[0, ]
54 54
    return(items)
55 55
  }
56 +
57 +
  theme = items$theme %>% select(theme = .data$href)
58 +
  self = items$self %>% rename(questions = .data$href)
59 +
56 60
  items = items %>%
57 -
    select(-settings, -self, -theme, -"_links") %>%
61 +
    select(-.data$settings, -.data$self, -.data$theme, -.data[["_links"]]) %>%
58 62
    as_tibble() %>%
59 63
    bind_cols(items$settings,
60 -
              items$self,
61 -
              items$theme,
64 +
              self,
65 +
              theme,
62 66
              items$`_links`) %>%
63 -
    rename(questions = href,
64 -
           theme = href1,
65 -
           questionnaire_url = display,
66 -
           last_updated = last_updated_at,
67 -
           form_id = id) %>%
67 +
    rename(questionnaire_url = .data$display,
68 +
           last_updated = .data$last_updated_at,
69 +
           form_id = .data$id) %>%
68 70
    mutate(last_updated = lubridate::ymd_hms(items$last_updated))
69 71
  attr(items, "total_items") = content$total_items
70 72
  attr(items, "page_count") = content$page_count

@@ -1,5 +1,3 @@
Loading
1 -
globalVariables(c("colors", "background"))
2 -
3 1
#' @title Theme functions
4 2
#'
5 3
#' Theme API functions
@@ -55,6 +53,7 @@
Loading
55 53
56 54
#' @rdname create_theme
57 55
#' @inheritParams get_forms
56 +
#' @importFrom rlang .data
58 57
#' @export
59 58
get_themes = function(api = NULL, page = 1, page_size = 10) {
60 59
  page = create_argument(page)
@@ -64,7 +63,7 @@
Loading
64 63
  content = get_response(api = api, url)
65 64
  items = content$items
66 65
  backgrounds = items %>%
67 -
    select(-colors, -background) %>%
66 +
    select(-.data$colors, -.data$background) %>%
68 67
    as_tibble() %>%
69 68
    bind_cols(items$colors, items$background)
70 69

@@ -8,9 +8,9 @@
Loading
8 8
    bind_cols()
9 9
}
10 10
11 -
globalVariables(c("answers", "metadata", "hidden", "calculated",
12 -
                  "landed_at", "submitted_at"))
11 +
13 12
#' @importFrom dplyr matches
13 +
#' @importFrom rlang .data
14 14
get_meta = function(content) {
15 15
  items = content$items
16 16
  if (length(items) == 0) {
@@ -21,11 +21,11 @@
Loading
21 21
    return(empty_meta)
22 22
  }
23 23
  meta = items %>%
24 -
    select(-answers, -metadata, -matches("hidden"), -matches("calculated")) %>%
24 +
    select(-.data$answers, -.data$metadata, -matches("hidden"), -matches("calculated")) %>%
25 25
    as_tibble() %>%
26 26
    bind_cols(items$metadata, items$hidden, items$calculated) %>%
27 -
    mutate(landed_at = ymd_hms(landed_at),
28 -
           submitted_at = ymd_hms(submitted_at))
27 +
    mutate(landed_at = ymd_hms(.data$landed_at),
28 +
           submitted_at = ymd_hms(.data$submitted_at))
29 29
30 30
  attr(meta, "total_items") = content$total_items
31 31
  attr(meta, "page_count") = content$page_count
@@ -33,7 +33,6 @@
Loading
33 33
}
34 34
35 35
36 -
globalVariables(".")
37 36
#' Download questionnaire results
38 37
#'
39 38
#' Download results for a particular typeform questionnaire.
@@ -105,8 +104,8 @@
Loading
105 104
  all_answers = answers %>%
106 105
    map(flatten_answers) %>%
107 106
    map2(items$landing_id, ~mutate(.x, landing_id = .y)) %>%
108 -
    bind_rows() %>%
109 -
    split(.$field_id)
107 +
    bind_rows()
108 +
  all_answers = split(all_answers, all_answers$field_id)
110 109
111 110
  question_types = all_answers %>%
112 111
    map(~select(.x, type_value)) %>%
@@ -117,7 +116,7 @@
Loading
117 116
  all_answers = all_answers %>%
118 117
    map2(question_types,
119 118
         ~select(.x,
120 -
                 "field_type", "landing_id", starts_with(paste0(.y, "_")))) %>%
119 +
                 .data$field_type, .data$landing_id, starts_with(paste0(.y, "_")))) %>%
121 120
    map(~unnest(.x, cols = c())) %>%
122 121
    map(~rename(.x, type = 1, value = 3))
123 122
Files Coverage
R 36.79%
Project Totals (14 files) 36.79%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading